KraXen72 / obsidian-painter

paint text different colors
Mozilla Public License 2.0
30 stars 0 forks source link

Change font color if colour contrast is too little #5

Closed MarcGoekce closed 2 months ago

MarcGoekce commented 2 months ago

If the highlight colour is black or something too dark, the text can't be read (easily).

Preview Source code
image image

Instead of adding a secondary colour parameter, what if there is an option (or the default) that changes the font colour to white depending of the contrast?

https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color

KraXen72 commented 2 months ago

this is quite difficult to do. it would require me to either calculate the contrast, which i want to avoid doing because it'll make even more of the stylesheet generated, or use some background-blend-mode trickerly.
I'm going to keep this issue open, but no promises or ETA.
PR's are welcome as long as it does not decrease performance. (if you want to calculate the colors, i suggest using an external library for it)

KraXen72 commented 2 months ago

i have decided to track this in #9