-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color approximation is off due to integer truncation. And other fixes. #5
Comments
@mathewreny thanks a lot for this! You should be able to send a PR without necessitating write access to the repo. If you fork the project and add your fork as a remote, you'll be able to push your changes to a branch on your fork and then open a PR against this repo. The commands would look like (after having fork'd using the github UI): # clone this repo
$ git clone https://github.com/aybabtme/rgbterm.git $GOPATH/src/github.com/aybabtme/rgbterm
$ cd $GOPATH/src/github.com/aybabtme/rgbterm
# add your fork as a Git remote
$ git remote add my_fork [email protected]/rgbterm.git
# push your changes to your remote, in a branch
$ git checkout -b branch_name
$ git add . -A
$ git commit -m "Fix to RGB approximation"
$ git push my_for branch_name Then when you visit https://github.com/aybabtme/rgbterm you'll be offered to open a PR with your fork/branch. FYI this is usually how it's done for Go projects, so if you're interested in contributing to other projects, it's a good thing to learn the method. 😄 If this is too much trouble or you don't feel like it 😉, feel free to just push your changes to a fork and let me know what commit it is, and I'll pull the change myself. |
Thank you for the fork instructions! You caught me, I'm new to this open source thing. I'll open a request once I write some new tests. |
@mathewreny, are you still planning to make a pull request for this one? If not, I might take a stab at it. |
@mathewreny would love to have these improvements in the code, are you still planning on making the changes? |
I noticed that the
color
function is not correct. Values close to 255 are truncated, so an entire plane of the 6x6x6 ansi color cube is never hit. Here is part of my update to solve this issue.Another problem was the 4kilobytes of memory this program consumes for no apparent reason. I solved this by removing the
codes.go
file and writingcolor
function output like soFinally, the grayscale function has been reduced to a bounds check and one line of math. This is much faster and allows grayscale values to round to the closest ansi value.
Here is a screenshot of the improved color approximation in action.
May I please have write access so I can submit a pull request?
The text was updated successfully, but these errors were encountered: