From 466410529a40b3f673063320965114f1aaa2c7da Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 2 Jul 2015 13:56:38 +0100 Subject: [PATCH 1/4] Add a colorscheme command and a first zenburn them in the colors directory --- colors/zenburn.kak | 47 ++++++++++++++++++++++++++++++++++++++++++++++ share/kak/colors | 1 + share/kak/kakrc | 17 +++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 colors/zenburn.kak create mode 120000 share/kak/colors diff --git a/colors/zenburn.kak b/colors/zenburn.kak new file mode 100644 index 000000000..ca94106e5 --- /dev/null +++ b/colors/zenburn.kak @@ -0,0 +1,47 @@ +# zenburn theme + +# first we define the zenburn colors as faces +face zenbackground rgb:3f3f3f +face zentext rgb:efefef +face zenkeyword rgb:f0dfaf+b +face zenstorageClass rgb:c3bf9f+b +face zennumber rgb:8cd0d3 +face zencomment rgb:7f9f7f +face zenconstant rgb:dca3a3+b +face zenspecial rgb:cfbfaf +face zenfunction rgb:efef8f +face zenstatement rgb:e3ceab +face zenidentifier rgb:efdcbc +face zentype rgb:dfdfbf +face zenstring rgb:cc9393 +face zenexception rgb:c3bf9f+b +face zenmatching rgb:3f3f3f,rgb:8cd0d3 + +# then we map them to code +face value zenconstant +face type zentype +face identifier zenidentifier +face string zenstring +face error zenexception +face keyword zenkeyword +face operator zenfunction +face attribute zenstatement +face comment zencomment +face meta zenspecial + +# and markup +face title zenkeyword +face header zenconstant +face bold zenstorageClass +face italic zenfunction +face mono zennumber +face block zenstatement +face link zenstring +face bullet zenidentifier +face list zentype + +face Default default,rgb:3f3f3f +face StatusLine rgb:efdcbc,rgb:2a2a2a +face Information rgb:cc9393,rgb:2a2a2a +face MenuBackground rgb:7f9f7f,rgb:4a4a4a +face MenuForeground rgb:8cd0d3,rgb:4a4a4a diff --git a/share/kak/colors b/share/kak/colors new file mode 120000 index 000000000..daf99fdc4 --- /dev/null +++ b/share/kak/colors @@ -0,0 +1 @@ +../../colors \ No newline at end of file diff --git a/share/kak/kakrc b/share/kak/kakrc index 38a15b8f8..e588fd481 100644 --- a/share/kak/kakrc +++ b/share/kak/kakrc @@ -30,6 +30,23 @@ def -shell-params runtime %{ %sh{ done }} +def -shell-params -docstring "colorscheme : enable named colorscheme" \ + -shell-completion %{ + prefix=${1:0:${kak_pos_in_token}} + ( + for col in ${kak_runtime}/colors/*.kak; do + expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$" + done + ) | grep -v '^$' + } \ + colorscheme %{ %sh{ + if [ $# -eq 1 ]; then + echo "source '${kak_runtime}/colors/$1.kak'" + else + echo -color Error 'Usage: colorscheme ' + fi +}} + %sh{ autoload() { dir=$1 From 742fdc1f7d8c8eeacbf765ec4c8a2bac7b6efdaa Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 3 Jul 2015 21:14:08 +0100 Subject: [PATCH 2/4] Recognize colorscheme command in kakrc files and in README --- README.asciidoc | 1 + rc/kakrc.kak | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index f76330b4c..687819f68 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -486,6 +486,7 @@ Basic Commands * `source `: execute commands in * `runtime `: execute commands in , is relative to kak executable path. + * `colorscheme `: load named colorscheme. * `nameclient `: set current client name * `namebuf `: set current buffer name * `echo `: show in status line diff --git a/rc/kakrc.kak b/rc/kakrc.kak index fe6a6df8d..0d423cece 100644 --- a/rc/kakrc.kak +++ b/rc/kakrc.kak @@ -8,7 +8,7 @@ addhl -group / regions -default code kakrc \ single_string %{(^|\h)'} %{(? 0:keyword +addhl -group /kakrc/code regex \<(hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias|unalias|decl|echo|edit|set|map|face|prompt|menu|info|try|catch|nameclient|namebuf|cd|colorscheme)\> 0:keyword addhl -group /kakrc/code regex \<(default|black|red|green|yellow|blue|magenta|cyan|white|(?:rgb:[0-9a-fA-F]{6}))\> 0:value addhl -group /kakrc/code regex (?:\ Date: Fri, 3 Jul 2015 21:14:34 +0100 Subject: [PATCH 3/4] Formatting fix --- share/kak/kakrc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/share/kak/kakrc b/share/kak/kakrc index e588fd481..beccc2844 100644 --- a/share/kak/kakrc +++ b/share/kak/kakrc @@ -31,20 +31,20 @@ def -shell-params runtime %{ %sh{ }} def -shell-params -docstring "colorscheme : enable named colorscheme" \ - -shell-completion %{ - prefix=${1:0:${kak_pos_in_token}} - ( - for col in ${kak_runtime}/colors/*.kak; do - expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$" - done - ) | grep -v '^$' - } \ - colorscheme %{ %sh{ - if [ $# -eq 1 ]; then - echo "source '${kak_runtime}/colors/$1.kak'" - else - echo -color Error 'Usage: colorscheme ' - fi + -shell-completion %{ + prefix=${1:0:${kak_pos_in_token}} + ( + for col in ${kak_runtime}/colors/*.kak; do + expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$" + done + ) | grep -v '^$' + } \ + colorscheme %{ %sh{ + if [ $# -eq 1 ]; then + echo "source '${kak_runtime}/colors/$1.kak'" + else + echo -color Error 'Usage: colorscheme ' + fi }} %sh{ From 287fc59c05f93a1c8755d9ae4900f69ff4b8ae6b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 4 Jul 2015 11:37:24 +0100 Subject: [PATCH 4/4] Update zenburn.kak --- colors/zenburn.kak | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/colors/zenburn.kak b/colors/zenburn.kak index ca94106e5..c092cbe15 100644 --- a/colors/zenburn.kak +++ b/colors/zenburn.kak @@ -1,7 +1,11 @@ # zenburn theme # first we define the zenburn colors as faces -face zenbackground rgb:3f3f3f +face zenbackground default,rgb:3f3f3f +face zenstatus rgb:efdcbc,rgb:2a2a2a +face zeninfo rgb:cc9393,rgb:2a2a2a +face zenmenubg rgb:7f9f7f,rgb:4a4a4a +face zenmenufg rgb:8cd0d3,rgb:4a4a4a face zentext rgb:efefef face zenkeyword rgb:f0dfaf+b face zenstorageClass rgb:c3bf9f+b @@ -40,8 +44,9 @@ face link zenstring face bullet zenidentifier face list zentype -face Default default,rgb:3f3f3f -face StatusLine rgb:efdcbc,rgb:2a2a2a -face Information rgb:cc9393,rgb:2a2a2a -face MenuBackground rgb:7f9f7f,rgb:4a4a4a -face MenuForeground rgb:8cd0d3,rgb:4a4a4a +# and built in faces +face Default zenbackground +face StatusLine zenstatus +face Information zeninfo +face MenuBackground zenmenubg +face MenuForeground zenmenufg