Skip to content
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

Feature request: better fg/bg contrast #19

Open
ipkiss42 opened this issue Oct 26, 2013 · 5 comments
Open

Feature request: better fg/bg contrast #19

ipkiss42 opened this issue Oct 26, 2013 · 5 comments

Comments

@ipkiss42
Copy link

Hi,

I am switching from chrisbra/color_highlight to ColorV, because ColorV has many more cool features. However, there is one minor annoyance: when displaying color names (e.g. with :ColorVPreview), the contrast between the fg and the bg colors is not always very readable.

For example, compare the highlighting of #ff014b between ColorHighlight and ColorV. ColorHighlight uses a "pure" white, whereas ColorV has less contrast.

So what about providing (possibly as an option) a stronger contrast between the fg and bg colors?

@gu-fan
Copy link
Owner

gu-fan commented Nov 14, 2013

well , I'm using a simple algorithm to process faster for generating fb/bg.
maybe I should read the color_highlight's code to find how to improve it.

@sashahart
Copy link
Contributor

By default, chrisbra/Colorizer just chooses black or white using

r*30 + g*59 + b*11 > 12000

(See ~ Colorizer/autoload/Colorizer.vim:1487).

I like ColorV's sophisticated coloring. But maybe ColorV can just have an option to choose black or white, for users who prefer maximum contrast.

@gu-fan
Copy link
Owner

gu-fan commented Jan 19, 2016

well, Don't have much time recently to get this small change..
any pull requests are welcome

@sashahart
Copy link
Contributor

I made an implementation for s:prev_list() which functions similarly to Colorizer, with a threshold at 777777.

-        let hi_fg = b:view_area==1 ? hex : s:rlt_clr(hex)
+
+        if b:view_area == 1
+            let hi_fg = hex
+        elseif g:colorv_preview_bw
+            let [y,i,q]=colorv#hex2yiq(hex)
+            " y = 47 for #777777, which should be middle gray.
+            let hi_fg = (y < 47) ? "#ffffff" : "#000000"
+        else
+            let hi_fg = s:rlt_clr(hex)
+        endif

But after trying it more, I don't like it. It badly distorts my perception of brightness. For example, 737373 looks much brighter than 787878 and even AAAAAA because of the selection of a white fg for the darker background. To me, it is so bad I would not even merge the option. My opinion is not important, but I don't like the feature enough to put my name on the commit. So if somebody else wants it, they can use it or come up with another solution.

@gu-fan
Copy link
Owner

gu-fan commented Feb 7, 2016

Fine~
Anyway , it's nice of you to explore this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants