Comments (15)
@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).
from base16-emacs.
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.
from base16-emacs.
On a side note, why would it need to be darker than base00?
from base16-emacs.
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.
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
from base16-emacs.
On a side note, why would it need to be darker than base00?
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.
from base16-emacs.
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.
from base16-emacs.
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?
from base16-emacs.
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)
from base16-emacs.
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.
from base16-emacs.
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..
from base16-emacs.
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.
from base16-emacs.
Right, so (171, 205, 18)
from base16-emacs.
(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.
When using"#191970" as the argument it returns (25 25 112) as 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.
from base16-emacs.
I pushed the functions to a branch called color-darken if you want to play with it a bit more.
from base16-emacs.
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 (ns/color-contrast-ratio
, ns/color-iterate
) - you could then EG enforce a minimum contrast between colors.
from base16-emacs.
Related Issues (20)
- Weird black block when using global-display-line-numbers-mode HOT 1
- dired mode background color HOT 1
- Face definition by indirection — define base16 named colors, or faces to inherit from? HOT 5
- git changes on fringe HOT 2
- Tomorrow Theme Terminal Colors HOT 3
- ansi-term-color-vector improperly overridden HOT 2
- Warning (comp): base16-theme-pkg.el:7:1: Warning: the function ‘define-package’ is not known HOT 1
- font-lock-comment-delimiter-face = base02, which is for selection background
- Increase selection contrast on tomorrow day theme
- base16-emacs breaks on zoom when global-display-line-numbers-mode HOT 1
- Maintainers outside of base16-project HOT 1
- Add support for `tab-bar`
- Doom Emacs support
- Some colorschemes are missing when compared with base16-vscode HOT 3
- Update base16-theme-256-color-source to use symbols, not strings
- fix command spell mistake in README HOT 2
- Emacs doesn't update colors with updated theme until I restart Emacs HOT 3
- Org todo/done faces match some heading faces HOT 2
- Foreground base04 is unreadable on background base03 with onedark theme HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from base16-emacs.