Skip to content

Commit

Permalink
Honor termguicolors and terminals with t_co > 256. Fixes: ap#186
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-rho committed Apr 10, 2024
1 parent faa6593 commit c4e3925
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion autoload/css_color.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
" Commit: $Format:%H$
" Licence: The MIT License (MIT)

if ! ( v:version >= 700 && has('syntax') && ( has('gui_running') || has('nvim') || &t_Co == 256 ) )
if ! ( v:version >= 700 && has('syntax') && (
\ has('gui_running') ||
\ has('nvim') ||
\ (has('termguicolors') && &termguicolors) ||
\ &t_Co >= 256
\ ) )
function! css_color#init(type, keywords, groups)
endfunction
function! css_color#extend(groups)
endfunction
function! css_color#disabled()
return v:true
endfunction
finish
endif

function! css_color#disabled()
return v:false
endfunction
function! s:rgb2color(r,g,b)
" Convert 80% -> 204, 100% -> 255, etc.
let rgb = map( [a:r,a:g,a:b], 'v:val =~ "%$" ? ( 255 * v:val ) / 100 : v:val' )
Expand Down

0 comments on commit c4e3925

Please sign in to comment.