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

Honor termguicolors and terminals with t_co > 256. Fixes: #186 #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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