1
0
mirror of https://github.com/gryf/wombat256grf.git synced 2025-12-17 11:30:19 +01:00

Update color function and rename it to get_color.

This commit is contained in:
2021-01-19 19:02:33 +01:00
parent 82f5f049f8
commit 714e81aa63

View File

@@ -120,7 +120,7 @@ fun s:get_rgb_idx(x, y, z)
endfun endfun
" returns the palette index to approximate the given R/G/B color levels " returns the palette index to approximate the given R/G/B color levels
fun <SID>color(r, g, b) fun s:get_color(r, g, b)
" get the closest grey " get the closest grey
let l:gx = s:get_approximate_grey_idx(a:r) let l:gx = s:get_approximate_grey_idx(a:r)
let l:gy = s:get_approximate_grey_idx(a:g) let l:gy = s:get_approximate_grey_idx(a:g)
@@ -144,14 +144,12 @@ fun <SID>color(r, g, b)
if l:dgrey < l:drgb if l:dgrey < l:drgb
" use the grey " use the grey
return s:get_grey_color_idx(l:gx) return s:get_grey_color_idx(l:gx)
else endif
" use the color " use the color
return s:get_rgb_idx(l:x, l:y, l:z) return s:get_rgb_idx(l:x, l:y, l:z)
endif endif
else
" only one possibility " only one possibility
return s:get_rgb_idx(l:x, l:y, l:z) return s:get_rgb_idx(l:x, l:y, l:z)
endif
endfun endfun
" returns the palette index to approximate the 'rrggbb' hex string " returns the palette index to approximate the 'rrggbb' hex string
@@ -159,7 +157,7 @@ fun <SID>rgb(rgb)
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return <SID>color(l:r, l:g, l:b) return s:get_color(l:r, l:g, l:b)
endfun endfun
" sets the highlighting for the given group " sets the highlighting for the given group
@@ -320,7 +318,7 @@ call <SID>X("SyntasticStyleWarningSign", "", "ffaa00", "")
delf <SID>Y delf <SID>Y
delf <SID>X delf <SID>X
delf <SID>rgb delf <SID>rgb
delf <SID>color delf s:get_color
delf s:get_rgb_idx delf s:get_rgb_idx
delf s:get_rgb_level delf s:get_rgb_level
delf s:get_approximate_rgb_idx delf s:get_approximate_rgb_idx