Add alacritty support (#132)

This commit is contained in:
Johannes M
2018-08-23 18:06:46 +02:00
committed by Josh Dick
parent 07ff25c34f
commit 7e03caaaf1
4 changed files with 80 additions and 1 deletions

View File

@@ -18,6 +18,9 @@ Here are the locations of the files that are generated by the build system, alon
|----------------------------------------------|------------------------------------------|
| `autoload/onedark.vim` | `build/templates/autoload.template.vim` |
| `term/One Dark.Xresources` | `build/templates/One Dark.Xresources` |
| `term/One Dark.itermcolors` | `build/templates/One Dark.itermcolors` |
| `term/One Dark.terminal` | `build/templates/One Dark.terminal` |
| `term/One Dark.alacritty` | `build/templates/One Dark.alacritty` |
### Configure It

View File

@@ -116,7 +116,7 @@ try {
const xresources = readFileSync(resolve(__dirname, '../term/One Dark.Xresources'), 'utf8')
const terminalPalette = termcolors.xresources.import(xresources)
let itermTemplate, terminalAppTemplate
let itermTemplate, terminalAppTemplate, alacrittyTemplate
// Compile custom terminal color templates based on ones that ship with termcolors
try {
@@ -128,6 +128,13 @@ try {
})
)
alacrittyTemplate = termcolors.export(
readFileSync(resolve(__dirname, 'templates/One Dark.alacritty')),
_.partialRight(_.mapValues, function (color) {
return color.toHex().slice(1)
})
)
// From termcolors/lib/formats/terminal-app.js
const code = [
new Buffer('62706c6973743030d40102030405061516582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a307080f55246e756c6cd3090a0b0c0d0e554e535247425c4e53436f6c6f7253706163655624636c6173734f1027', 'hex'),
@@ -155,6 +162,7 @@ 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))
} catch (e) {
handleError('Error writing terminal color file', e)
}

View File

@@ -0,0 +1,34 @@
# Colors (One Dark)
colors:
# Default colors
primary:
background: '0x{{=c[0]}}'
foreground: '0x{{=c[7]}}'
# Cursor colors
cursor:
background: '0x{{=c[7]}}'
foreground: '0x{{=c[0]}}'
# Normal colors
normal:
black: '0x{{=c[0]}}'
red: '0x{{=c[1]}}'
green: '0x{{=c[2]}}'
yellow: '0x{{=c[3]}}'
blue: '0x{{=c[4]}}'
magenta: '0x{{=c[5]}}'
cyan: '0x{{=c[6]}}'
white: '0x{{=c[7]}}'
# Bright colors
bright:
black: '0x{{=c[8]}}'
red: '0x{{=c[9]}}'
green: '0x{{=c[10]}}'
yellow: '0x{{=c[11]}}'
blue: '0x{{=c[12]}}'
magenta: '0x{{=c[13]}}'
cyan: '0x{{=c[14]}}'
white: '0x{{=c[15]}}'

34
term/One Dark.alacritty Normal file
View File

@@ -0,0 +1,34 @@
# Colors (One Dark)
colors:
# Default colors
primary:
background: '0x282c34'
foreground: '0xabb2bf'
# Cursor colors
cursor:
background: '0xabb2bf'
foreground: '0x282c34'
# Normal colors
normal:
black: '0x282c34'
red: '0xe06c75'
green: '0x98c379'
yellow: '0xe5c07b'
blue: '0x61afef'
magenta: '0xc678dd'
cyan: '0x56b6c2'
white: '0xabb2bf'
# Bright colors
bright:
black: '0x3e4452'
red: '0xbe5046'
green: '0x98c379'
yellow: '0xd19a66'
blue: '0x61afef'
magenta: '0xc678dd'
cyan: '0x56b6c2'
white: '0x5c6370'