Terminal color tweaks. (#201)

* Add KiTTY configuration (manually; could potentially use
  https://github.com/stayradiated/termcolors/pull/17/ in the future)
* Tweak foreground/background/white/black colors to be visually distinct
  from one another

Closes #200.
This commit is contained in:
Josh Dick
2020-01-20 17:34:29 -05:00
committed by GitHub
parent 6a98de099d
commit 181a7866bc
9 changed files with 121 additions and 31 deletions

View File

@@ -103,10 +103,17 @@ try {
const xresources = readFileSync(resolve(__dirname, '../term/One Dark.Xresources'), 'utf8')
const terminalPalette = termcolors.xresources.import(xresources)
let itermTemplate, terminalAppTemplate, alacrittyTemplate
let alacrittyTemplate, itermTemplate, kittyTemplate, terminalAppTemplate
// Compile custom terminal color templates based on ones that ship with termcolors
try {
alacrittyTemplate = termcolors.export(
readFileSync(resolve(__dirname, 'templates/One Dark.alacritty')),
_.partialRight(_.mapValues, function (color) {
return color.toHex().slice(1)
})
)
itermTemplate = termcolors.export(
// From termcolors/lib/formats/iterm.js
readFileSync(resolve(__dirname, 'templates/One Dark.itermcolors')),
@@ -115,8 +122,8 @@ try {
})
)
alacrittyTemplate = termcolors.export(
readFileSync(resolve(__dirname, 'templates/One Dark.alacritty')),
kittyTemplate = termcolors.export(
readFileSync(resolve(__dirname, 'templates/One Dark.kitty')),
_.partialRight(_.mapValues, function (color) {
return color.toHex().slice(1)
})
@@ -147,9 +154,10 @@ try {
}
try {
writeFileSync(resolve(__dirname, '../term/One Dark.itermcolors'), itermTemplate(terminalPalette))
writeFileSync(resolve(__dirname, '../term/One Dark.terminal'), terminalAppTemplate(terminalPalette))
writeFileSync(resolve(__dirname, '../term/One Dark.alacritty'), alacrittyTemplate(terminalPalette))
writeFileSync(resolve(__dirname, '../term/One Dark.itermcolors'), itermTemplate(terminalPalette))
writeFileSync(resolve(__dirname, '../term/One Dark.kitty'), kittyTemplate(terminalPalette))
writeFileSync(resolve(__dirname, '../term/One Dark.terminal'), terminalAppTemplate(terminalPalette))
} catch (e) {
handleError('Error writing terminal color file', e)
}

View File

@@ -4,8 +4,8 @@
*.cursorColor: <%=white.gui%>
! black
*.color0: <%=black.gui%>
*.color8: <%=visual_grey.gui%>
*.color0: <%=comment_grey.gui%>
*.color8: <%=gutter_fg_grey.gui%>
! red
*.color1: <%=red.gui%>
@@ -33,5 +33,5 @@
! white
*.color7: <%=white.gui%>
*.color15: <%=comment_grey.gui%>
*.color15: <%=visual_grey.gui%>

View File

@@ -2,8 +2,8 @@
colors:
# Default colors
primary:
background: '0x{{=c[0]}}'
foreground: '0x{{=c[7]}}'
foreground: '0x{{=c.foreground}}'
background: '0x{{=c.background}}'
# Cursor colors
cursor:

View File

@@ -0,0 +1,41 @@
# Cursor
cursor #{{=c[7]}}
cursor_text_color #{{=c[0]}}
# Special
foreground #{{=c.foreground}}
background #{{=c.background}}
selection_foreground #{{=c[0]}}
selection_background #{{=c[7]}}
# Black
color0 #{{=c[0]}}
color8 #{{=c[8]}}
# Red
color1 #{{=c[1]}}
color9 #{{=c[9]}}
# Green
color2 #{{=c[2]}}
color10 #{{=c[10]}}
# Yellow
color3 #{{=c[3]}}
color11 #{{=c[11]}}
# Blue
color4 #{{=c[4]}}
color12 #{{=c[12]}}
# Magenta
color5 #{{=c[5]}}
color13 #{{=c[13]}}
# Cyan
color6 #{{=c[6]}}
color14 #{{=c[14]}}
# White
color7 #{{=c[7]}}
color15 #{{=c[15]}}