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

Update rgb_color function

This commit is contained in:
2021-01-19 19:01:15 +01:00
parent 23bedc8306
commit 82f5f049f8

View File

@@ -112,12 +112,11 @@ fun s:get_rgb_level(n)
endfun endfun
" returns the palette index for the given R/G/B color indices " returns the palette index for the given R/G/B color indices
fun <SID>rgb_color(x, y, z) fun s:get_rgb_idx(x, y, z)
if &t_Co == 88 if &t_Co == 88
return 16 + (a:x * 16) + (a:y * 4) + a:z return 16 + (a:x * 16) + (a:y * 4) + a:z
else
return 16 + (a:x * 36) + (a:y * 6) + a:z
endif endif
return 16 + (a:x * 36) + (a:y * 6) + a: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
@@ -147,11 +146,11 @@ fun <SID>color(r, g, b)
return s:get_grey_color_idx(l:gx) return s:get_grey_color_idx(l:gx)
else else
" use the color " use the color
return <SID>rgb_color(l:x, l:y, l:z) return s:get_rgb_idx(l:x, l:y, l:z)
endif endif
else else
" only one possibility " only one possibility
return <SID>rgb_color(l:x, l:y, l:z) return s:get_rgb_idx(l:x, l:y, l:z)
endif endif
endfun endfun
@@ -322,7 +321,7 @@ delf <SID>Y
delf <SID>X delf <SID>X
delf <SID>rgb delf <SID>rgb
delf <SID>color delf <SID>color
delf <SID>rgb_color 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
delf s:get_grey_color_idx delf s:get_grey_color_idx