-
Notifications
You must be signed in to change notification settings - Fork 76
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
Solaire mode support #97
Comments
Having a lighten and darken function is something I’ve considered for the diff functionality as well. I would accept a PR to add this. |
On a side note, why would it need to be darker than base00? |
I know how to do this, but in Elisp it's a little bit harder because there's no function for converting hex to rgb, though there's a way to convert it backwards. I'll implement it as soon as I can |
The principle of Solaire mode is to dim the non editing buffers to give contrast. Though sometimes in certain themes some authors do lighten instead of darken the theme (i.e. doom-iovskem) that just happens for themes that are too dark, the usual and in my personal opinion more aesthetic way to go is to darken the non editing buffers. |
Is there another format it could be in that would make it easier? I could change the generated templates to include the data in another format if needed. |
I think we'd have to transform base 16 in base 18 😅. What did you have in mind? |
You mentioned the conversion from hex to rgb not existing in elisp - I could update the provided color variables exposed to also provide rgb values. (See http://chriskempson.com/projects/base16/#template-variables) |
Ok, I think I only need the rgb value for the base00, however I don't know if it would be needed for the others in the future so you can decide. From there is just multiply the r, g and b of the base00 for a certain factor (it could be 0.5 for darkening and 1.5 for lightening, though I'd like to try some and then we can decide) and generate the new, darker version of base00 for solaire-default/any other face that needs it. |
After playing with it, I'd rather not go this route - https://github.com/belak/base16-emacs/tree/rgb-experiment It's pretty ugly and introduces data duplication. Unfortunately, I think it would make more sense to have functions for converting from rgb to hex and back.. |
Yes , the latter one already exist (no clue why the function for converting from hex to rgb doen't exist but from rgb to hex does) so let's start from there. I should go like this, take for example the following hex color: #ABCD12, the RGB would be (AB, CD, 12) converted to decimal if I'm not wrong. |
Right, so (171, 205, 18) |
(defun base16-hex-to-rgb (hexcolor)
`(,(string-to-number (substring hexcolor 1 3) 16)
,(string-to-number (substring hexcolor 3 5) 16)
,(string-to-number (substring hexcolor 5 7) 16))) There ya go, it was easier than expected. I think that I'll be finishing all the implementation of the darken/lighting functions and solaire-mode tomorrow maybe at the end of the morning. |
I pushed the functions to a branch called color-darken if you want to play with it a bit more. |
necrobump! I've been playing much with emacs builtin color.el this past week and would like to share some stuff I found. @ema2159 I learned that emacs ships with conversion functions for hex and rgb (though it uses 0.0 - 1.0 instead of 0-{FF or FFFF}), and some helper functions for lightening and darkening colors. EG: (require 'color)
(color-name-to-rgb "#999999")
;; => (0.6 0.6 0.6)
;; darken and lighten take percents:
(color-darken-name "#999999" 5)
;; => "#8ccc8ccc8ccc"
(color-lighten-name "#999999" 5)
;; => "#a665a665a665"
;; convert a color to RGB , add some blue, convert it back:
(->> (color-name-to-rgb "#999999")
(apply (lambda (R G B)
;; RGB are all in a 0.0-1.0 range
(list R G (+ 0.2 B))))
(apply 'color-rgb-to-hex))
;; => "#99999999cccc" I'm not sure what the minimum emacs version is for color.el, the copyright is 2010. It's got some other helpers for working with other colorspaces as well (HSL/HSV, LAB/LCH). On top of these I built some helpers (feel free to steal) for comparing colors and "tweaking" them in different colorspaces while I tried things, which is currently culminating on a bootstrap using the base16 builder (thanks for your awesome work/wide package coverage, @belak) Of interest to the base16 repo might be the contrast comparison stuff ( |
@neeasade hey! Thanks! Yeah, I discovered these a little bit too late. They should do the work, however, I'm not sure if this PR will still be accepted though. I think the best thing to do is to redo it. I was quite inexperienced with elisp back then (still am, but a little bit less). |
Because of the limited color palette (16 colors) Solaire mode cannot implemented in a straightforward way. I have an idea to implement it though so I wanted to see if you'd be open to receive a PR. My idea is to implement a
base16-darken-color
function to darken the base00 color programatically and then use that for the solaire-default face. What you think?The text was updated successfully, but these errors were encountered: