cleanup theme and add color

This commit is contained in:
Niccolo Borgioli 2023-03-08 15:56:11 +01:00
parent 8fc5062d40
commit a57d8a5f42
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
6 changed files with 278 additions and 62 deletions

1
files/omp/colors/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -0,0 +1,106 @@
[
{
"properties": {
"steps": 8,
"hue": {
"start": 209,
"end": 259,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.03,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.03,
"curve": "easeInQuart"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Main",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 0,
"end": 15,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Error",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 60,
"end": 70,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Warning",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 122,
"end": 146,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Success",
"rotation": "clockwise"
}
}
]

21
files/omp/colors/index.js Normal file
View File

@ -0,0 +1,21 @@
import color from '@k-vyn/coloralgorithm'
import colors from './colors.json' assert { type: 'json' }
import fs from 'fs'
import yaml from 'yaml'
const offset = 10
const palette = {}
for (const { properties, options } of colors) {
const result = color.generate(properties, options)
const name = result[0].name
for (const color of result[0].colors) {
palette[`${name.toLowerCase()}-${color.step * offset}`] = color.hex
}
}
const configFile = '../main.omp.yaml'
const config = await fs.readFileSync(configFile, 'utf8')
// config.palette = palette
const output = yaml.stringify({ palette })
await fs.writeFileSync(configFile, config.replace(/palette:(.|\s)*$/, output))

View File

@ -0,0 +1,8 @@
{
"type": "module",
"main": "index.js",
"dependencies": {
"@k-vyn/coloralgorithm": "^1.0.0",
"yaml": "^2.2.1"
}
}

31
files/omp/colors/pnpm-lock.yaml generated Normal file
View File

@ -0,0 +1,31 @@
lockfileVersion: 5.4
specifiers:
'@k-vyn/coloralgorithm': ^1.0.0
yaml: ^2.2.1
dependencies:
'@k-vyn/coloralgorithm': 1.0.0
yaml: 2.2.1
packages:
/@k-vyn/coloralgorithm/1.0.0:
resolution: {integrity: sha512-a9aAOXxQ+c2Mw5sMC39elT0wYkPa3qktFjtxVkfY3mQEFBr7NMQEczCARVdkmIKo1dIrgNSx3z12sTXohzSZDg==}
dependencies:
bezier-easing: 2.1.0
chroma-js: 2.4.2
dev: false
/bezier-easing/2.1.0:
resolution: {integrity: sha512-gbIqZ/eslnUFC1tjEvtz0sgx+xTK20wDnYMIA27VA04R7w6xxXQPZDbibjA9DTWZRA2CXtwHykkVzlCaAJAZig==}
dev: false
/chroma-js/2.4.2:
resolution: {integrity: sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==}
dev: false
/yaml/2.2.1:
resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==}
engines: {node: '>= 14'}
dev: false

View File

@ -6,7 +6,16 @@ common:
diamond: &diamond
style: diamond
leading_diamond: ""
# trailing_diamond: ""
trailing_diamond: ""
diamond_prefix: &diamond_prefix
style: diamond
leading_diamond: ""
dynamic: &dynamic
style: dynamic
leading_diamond: ""
trailing_diamond: ""
background: "p:main-10"
foreground: "p:main-70"
powerline: &powerline
style: powerline
powerline_symbol: ""
@ -14,93 +23,133 @@ common:
blocks:
- alignment: left
segments:
- <<: *diamond
background: "#ffffff"
foreground: "#000000"
template: "{{ if .WSL }}WSL at {{ end }}{{.Icon}} "
type: os
- <<: *powerline
type: root
properties:
style: full
- type: os
<<: *diamond_prefix
background: "p:main-5"
foreground: "p:main-70"
- type: root
template: "  "
background: "#0000ff"
foreground: "#000000"
- <<: *powerline
type: path
properties:
style: full
<<: *powerline
background: "p:error-15"
foreground: "p:main-70"
- type: path
template: " {{ .Path }} "
background: "#0000ff"
foreground: "#ffffff"
- <<: *powerline
type: git
properties:
style: full
<<: *powerline
background: "p:main-40"
foreground: "p:main-0"
- type: git
template: " {{ .HEAD }} "
background: "#D4E157"
foreground: "#000000"
<<: *powerline
background: "p:warning-10"
foreground: "p:main-70"
type: prompt
- alignment: right
segments:
# ENVS
- background: "#7FD5EA"
foreground: "#000000"
leading_diamond: ""
style: diamond
template:
" {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{
end }}{{ .Full }}{{ end }} <transparent></>"
type: python
- background: "#7FD5EA"
foreground: "#ffffff"
leading_diamond: ""
style: diamond
template: " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} <transparent></>"
type: go
- background: "#7FD5EA"
foreground: "#000000"
leading_diamond: ""
style: diamond
template: " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} <transparent></>"
type: node
- type: python
<<: *dynamic
- type: go
<<: *dynamic
- type: node
<<: *dynamic
- type: kubectl
template: "{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }} <transparent></>"
background: "#7FD5EA"
foreground: "#000000"
style: diamond
leading_diamond: ""
template: "{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }}"
<<: *dynamic
- type: docker
template: "{{ .Icon }} {{ .Server }}"
<<: *dynamic
- type: rust
<<: *dynamic
- type: battery
<<: *dynamic
# UTILITY
- <<: *diamond
type: shell
background: "#D4E157"
foreground: "#000000"
template: "{{ .Name }}"
- <<: *powerline
type: executiontime
# STATIC UTILITY
- type: exit
template: "{{ .Code }}"
properties:
always_enabled: true
<<: *diamond_prefix
background: "p:main-10"
foreground: "p:main-70"
- type: executiontime
properties:
style: round
always_enabled: true
background: "#82eeff"
foreground: "#000000"
- <<: *powerline
background: "#ffffff"
foreground: "#000000"
<<: *powerline
background: "p:main-5"
foreground: "p:main-70"
- type: time
template: " {{ .CurrentDate | date .Format }} "
properties:
time_format: "15:04:05"
template: " {{ .CurrentDate | date .Format }} "
type: time
<<: *powerline
background: "p:main-0"
foreground: "p:main-70"
type: prompt
- alignment: left
newline: true
segments:
- foreground: "#D4E157"
- foreground: "p:main-15"
foreground_templates:
- "{{ if gt .Code 0 }}#FF5252{{ end }}"
- "{{ if gt .Code 0 }}p:error-15{{ end }}"
properties:
always_enabled: true
style: plain
template: " "
type: exit
type: prompt
# https://colorbox.io/
# Generated by ./color
palette:
main-0: "#f7fbff"
main-5: "#d6e6fe"
main-10: "#b4cafd"
main-15: "#95a9fc"
main-20: "#7783fa"
main-30: "#5348f4"
main-40: "#4826e8"
main-50: "#3e10ca"
main-60: "#22036e"
main-70: "#020008"
error-0: "#ff4040"
error-5: "#f03a34"
error-10: "#e23629"
error-15: "#d33220"
error-20: "#c52e18"
error-30: "#a8280d"
error-40: "#8a2106"
error-50: "#6d1b02"
error-60: "#501401"
error-70: "#330d00"
warning-0: "#ffff40"
warning-5: "#ecf034"
warning-10: "#dae229"
warning-15: "#c8d320"
warning-20: "#b6c518"
warning-30: "#96a80d"
warning-40: "#788a06"
warning-50: "#5d6d02"
warning-60: "#435001"
warning-70: "#2a3300"
success-0: "#40ff46"
success-5: "#34f044"
success-10: "#29e243"
success-15: "#20d342"
success-20: "#18c541"
success-30: "#0da83d"
success-40: "#068a36"
success-50: "#026d2d"
success-60: "#015022"
success-70: "#003316"