ct.el
ct.el copied to clipboard
ideas
- an explicit rgb to sRGB conversion function (or gamma correction function)
- CMYK? Peter's color notes have what he describes as a /very rough/ set of RGB <--> CMYK conversion functions
- note: CMYK space is smaller than RGB, so would need to be sure to clamp going out
- munsell color system
- color mixing by colorspace properties -- you could mix with a percentage value with all or one color property towards another (or average in the middle/mix completely, rather than approach)
- ~support RGB colorspace (we just kinda leave everyone to their own devices there rn)~
~a function that would tell me the resulting color of a top layer color with opacity over a bottom layer color~
- color temperature functions
- color correction functions (I mention gamma correction above, but color correction in general is just a whole nother rabbit hole)
peep chroma.js, and this article
OKlab https://bottosson.github.io/posts/oklab/ https://raphlinus.github.io/color/2021/01/18/oklab-critique.html
~a version of ct-iterate that "amplifies" a unary transform function when the result is the same (EG, upping the darken color by value until something happens, rather than just assuming the passed transform is enough)~
better compensation when tweaking individual properties beyond compatible ranges -- see for example the sliders here https://css.land/lch/ -- you have to raise brightness in order to be able to raise chroma
- a function that takes in a color and list of colors, returning the color from the list that is closest
^ WONTFIX, currently possible:
(let* ((colors '("#000000" "#888888" "#ffffff"))
(candidate "#777777"))
(first
(seq-sort-by
(-partial 'ct-distance candidate)
'< colors))) ; yields "#888888"
Would love a function to find the closest color at bit-depth d
. For example, I often have to find the closest 8-bit terminal color to a 24-bit source color when defining an Emacs color theme.
@tadfisher Thanks for the idea! -- in the meantime if you have a known list of colors (eg a list of "8 bit" colors) you can use something like the example I just added here: https://github.com/neeasade/ct.el/issues/5#issuecomment-1159187011
@tadfisher Thanks for the idea! -- in the meantime if you have a known list of colors (eg a list of "8 bit" colors) you can use something like the example I just added here: https://github.com/neeasade/ct.el/issues/5#issuecomment-1159187011
Actually that makes sense; I didn't realize that "256 color" terminals use particular color values instead of a uniform 8-bit distribution. Thanks!