Skip to content

Commit

Permalink
color-scheme: Replace existing schemes with new default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
codyopel committed Jul 7, 2023
1 parent 448e6a3 commit cef7ff2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 94 deletions.
133 changes: 41 additions & 92 deletions color-scheme.elv
Original file line number Diff line number Diff line change
Expand Up @@ -19,102 +19,50 @@ use ./osc
use ./rgb


# https://github.com/JesseLeite/an-old-hope-syntax-atom
fn an-old-hope {
put [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#1c1d21'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#eb3d54'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#78bd65'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#e5cd52'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#377d97'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#d169f1'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#4fb4d8'))
&7=(rgb:hex-to-dec (rgb:hexstr-to-map '#848794'))
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#686b78'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#ef7c2a'))
# https://gerrit.googlesource.com/gitiles/+/01abf45592fe7dc4a349f9c396016a13cfd241ca/resources/com/google/gitiles/static/prettify/prettify.css
var gitiles = [
&light= [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#000000'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#880000'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#008800'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#666600'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#000088'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#660066'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#006666'))
&7=(rgb:hex-to-dec (rgb:hexstr-to-map '#eeeeee'))
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#888888'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#660000'))
&10=2
&11=3
&12=4
&13=5
&14=6
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#cbcdd2'))
&bg=0
&fg=15
]
}

# https://github.com/primer/github-atom-light-syntax
fn github {
put [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#ffffff'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#D73A49'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#795DA3'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#24292e'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#183691'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#795da3'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#005CC5'))
&7=3
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#6a737d'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#e36209'))
&10=(rgb:hex-to-dec (rgb:hexstr-to-map '#795da3'))
&11=(rgb:hex-to-dec (rgb:hexstr-to-map '#183691'))
&12=(rgb:hex-to-dec (rgb:hexstr-to-map '#0086b3'))
&13=(rgb:hex-to-dec (rgb:hexstr-to-map '#c8c8fa'))
&14=(rgb:hex-to-dec (rgb:hexstr-to-map '#0086b3'))
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#24292e'))
&bg=0
&fg=15
]
}

# https://github.com/morhetz/gruvbox
fn gruvbox {
put [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#282828'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#cc241d'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#98971a'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#d79921'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#458588'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#b16286'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#689d6a'))
&7=(rgb:hex-to-dec (rgb:hexstr-to-map '#a89984'))
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#928374'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#fb4934'))
&10=(rgb:hex-to-dec (rgb:hexstr-to-map '#b8bb26'))
&11=(rgb:hex-to-dec (rgb:hexstr-to-map '#fabd2f'))
&12=(rgb:hex-to-dec (rgb:hexstr-to-map '#83a598'))
&13=(rgb:hex-to-dec (rgb:hexstr-to-map '#d3869b'))
&14=(rgb:hex-to-dec (rgb:hexstr-to-map '#8ec07c'))
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#ebdbb2'))
&bg=0
&fg=15
&11=(rgb:hex-to-dec (rgb:hexstr-to-map '#444400'))
&12=(rgb:hex-to-dec (rgb:hexstr-to-map '#000066'))
&13=(rgb:hex-to-dec (rgb:hexstr-to-map '#440044'))
&14=(rgb:hex-to-dec (rgb:hexstr-to-map '#004444'))
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#eeeeee'))
&bg=(rgb:hex-to-dec (rgb:hexstr-to-map '#FFFFFF'))
&fg=(rgb:hex-to-dec (rgb:hexstr-to-map '#000000'))
]
}

# http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
fn monokai {
put [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#272822'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#f92672'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#a6e22e'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#e6db74'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#2196e8'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#ae81ff'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#66d9ef'))
&7=(rgb:hex-to-dec (rgb:hexstr-to-map '#f8f8f2'))
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#75715e'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#fd971f'))
&dark= [
&0=(rgb:hex-to-dec (rgb:hexstr-to-map '#000000'))
&1=(rgb:hex-to-dec (rgb:hexstr-to-map '#ff6d6d'))
&2=(rgb:hex-to-dec (rgb:hexstr-to-map '#6dff6d'))
&3=(rgb:hex-to-dec (rgb:hexstr-to-map '#ffff85'))
&4=(rgb:hex-to-dec (rgb:hexstr-to-map '#79abff'))
&5=(rgb:hex-to-dec (rgb:hexstr-to-map '#ff85ff'))
&6=(rgb:hex-to-dec (rgb:hexstr-to-map '#85ffff'))
&7=(rgb:hex-to-dec (rgb:hexstr-to-map '#e8e6e3'))
&8=(rgb:hex-to-dec (rgb:hexstr-to-map '#888888'))
&9=(rgb:hex-to-dec (rgb:hexstr-to-map '#660000'))
&10=2
&11=3
&11=(rgb:hex-to-dec (rgb:hexstr-to-map '#444400'))
&12=4
&13=5
&14=6
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#f8f8f0'))
&bg=(rgb:hex-to-dec (rgb:hexstr-to-map '#282828'))
&fg=(rgb:hex-to-dec (rgb:hexstr-to-map '#f8f8f2'))
&13=(rgb:hex-to-dec (rgb:hexstr-to-map '#440044'))
&14=(rgb:hex-to-dec (rgb:hexstr-to-map '#004444'))
&15=(rgb:hex-to-dec (rgb:hexstr-to-map '#eeeeee'))
&bg=(rgb:hex-to-dec (rgb:hexstr-to-map '#131516'))
&fg=(rgb:hex-to-dec (rgb:hexstr-to-map '#e8e6e3'))
]
}

]

# Defines terminals colors used by ANSI 0-15 color codes.
# example_colors = [
Expand All @@ -128,7 +76,7 @@ fn -eval-color-scheme {|colorScheme|
var colorSchemeEval = [&]
var colorSchemeMapped = [ ]
# Manually define keys to ensure they all exist.
for i [ (range 16 | each {|a|to-string $a}) 'bg' 'fg' ] {
for i [ (range 16 | each {|a| to-string $a }) 'bg' 'fg' ] {
var rgb = $colorScheme[$i]

# Allow re-assigning values. Since we only accept RGB as a map,
Expand All @@ -152,7 +100,8 @@ fn -eval-color-scheme {|colorScheme|
}

fn set {|colorScheme|
set colorScheme = (-eval-color-scheme $colorScheme)
# FIXME: implement light/dark support
set colorScheme = (-eval-color-scheme $colorScheme['dark'])

osc:set-background-color $colorScheme['bg']
osc:set-foreground-color $colorScheme['fg']
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-ansi.elv
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn ucd-control-dec {|line|
fn ucd-find-ccs {
var unicodedata = (path_:temp-file)
download 'UnicodeData.txt' > $unicodedata
var ucd = [ (io:cat $unicodedata[name]) ]
var ucd = [ (str:to-nonempty-lines (io:open $unicodedata[name])) ]
for i $ucd {
var dec = (ucd-control-dec $i)
if (eq $dec $nil) {
Expand Down Expand Up @@ -90,7 +90,7 @@ fn map-names {

var control-chars-map = (create-map $control-chars)

for line [ (io:cat $namealiases[name]) ] {
for line [ (str:to-nonempty-lines (io:cat $namealiases[name])) ] {
echo $line >&2
if (or (str:has-prefix $line '#') (==s $line '')) {
continue
Expand Down

0 comments on commit cef7ff2

Please sign in to comment.