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"
}
}

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 diamond: &diamond
style: diamond style: diamond
leading_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 powerline: &powerline
style: powerline style: powerline
powerline_symbol: "" powerline_symbol: ""
@ -14,93 +23,133 @@ common:
blocks: blocks:
- alignment: left - alignment: left
segments: segments:
- <<: *diamond - type: os
background: "#ffffff" <<: *diamond_prefix
foreground: "#000000" background: "p:main-5"
template: "{{ if .WSL }}WSL at {{ end }}{{.Icon}} " foreground: "p:main-70"
type: os
- <<: *powerline - type: root
type: root
properties:
style: full
template: "  " template: "  "
background: "#0000ff"
foreground: "#000000"
- <<: *powerline
type: path
properties: properties:
style: full style: full
<<: *powerline
background: "p:error-15"
foreground: "p:main-70"
- type: path
template: " {{ .Path }} " template: " {{ .Path }} "
background: "#0000ff" properties:
foreground: "#ffffff" style: full
- <<: *powerline <<: *powerline
type: git background: "p:main-40"
foreground: "p:main-0"
- type: git
template: " {{ .HEAD }} " template: " {{ .HEAD }} "
background: "#D4E157" <<: *powerline
foreground: "#000000" background: "p:warning-10"
foreground: "p:main-70"
type: prompt type: prompt
- alignment: right - alignment: right
segments: segments:
# ENVS # ENVS
- background: "#7FD5EA" - type: python
foreground: "#000000" <<: *dynamic
leading_diamond: "" - type: go
style: diamond <<: *dynamic
template: - type: node
" {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ <<: *dynamic
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: kubectl - type: kubectl
template: "{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }} <transparent></>" template: "{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }}"
background: "#7FD5EA" <<: *dynamic
foreground: "#000000" - type: docker
style: diamond template: "{{ .Icon }} {{ .Server }}"
leading_diamond: "" <<: *dynamic
- type: rust
<<: *dynamic
- type: battery
<<: *dynamic
# UTILITY # STATIC UTILITY
- <<: *diamond - type: exit
type: shell template: "{{ .Code }}"
background: "#D4E157" properties:
foreground: "#000000" always_enabled: true
template: "{{ .Name }}" <<: *diamond_prefix
- <<: *powerline background: "p:main-10"
type: executiontime foreground: "p:main-70"
- type: executiontime
properties: properties:
style: round style: round
always_enabled: true always_enabled: true
background: "#82eeff" <<: *powerline
foreground: "#000000" background: "p:main-5"
- <<: *powerline foreground: "p:main-70"
background: "#ffffff"
foreground: "#000000" - type: time
template: " {{ .CurrentDate | date .Format }} "
properties: properties:
time_format: "15:04:05" time_format: "15:04:05"
template: " {{ .CurrentDate | date .Format }} " <<: *powerline
type: time background: "p:main-0"
foreground: "p:main-70"
type: prompt type: prompt
- alignment: left - alignment: left
newline: true newline: true
segments: segments:
- foreground: "#D4E157" - foreground: "p:main-15"
foreground_templates: foreground_templates:
- "{{ if gt .Code 0 }}#FF5252{{ end }}" - "{{ if gt .Code 0 }}p:error-15{{ end }}"
properties: properties:
always_enabled: true always_enabled: true
style: plain style: plain
template: " " template: " "
type: exit type: exit
type: prompt 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"