Introduce Rofi adapter, Serpensortia theme, and additional scripts for anime playback and theme customization
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"Sithego/themer/adapters/gtk"
|
||||
"Sithego/themer/adapters/intellij"
|
||||
"Sithego/themer/adapters/qt"
|
||||
"Sithego/themer/adapters/rofi"
|
||||
"Sithego/themer/adapters/starship"
|
||||
)
|
||||
|
||||
@@ -31,6 +32,10 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := rofi.New(rofi.WithOutputDir("../dotfiles/.themes/")).Generate(theme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := dunst.New(dunst.WithOutputDir("../dotfiles/.config/dunst/")).Generate(theme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package rofi
|
||||
|
||||
import (
|
||||
"Sithego/themer"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type Adapter struct {
|
||||
OutputDir string
|
||||
}
|
||||
|
||||
type Option func(*Adapter)
|
||||
|
||||
func WithOutputDir(dir string) Option {
|
||||
return func(a *Adapter) {
|
||||
a.OutputDir = dir
|
||||
}
|
||||
}
|
||||
|
||||
func New(opt ...Option) *Adapter {
|
||||
home, _ := os.UserHomeDir()
|
||||
a := &Adapter{
|
||||
OutputDir: filepath.Join(home, ".themes"),
|
||||
}
|
||||
for _, o := range opt {
|
||||
o(a)
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *Adapter) Name() string {
|
||||
return "Rofi"
|
||||
}
|
||||
|
||||
func (a *Adapter) Generate(t themer.Theme) error {
|
||||
templatePath := filepath.Join("themer/adapters/rofi", "theme.rasi")
|
||||
templ, err := template.ParseFiles(templatePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
outputPath := filepath.Join(a.OutputDir, t.Meta.Name, "rofi", "theme.rasi")
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(outputPath), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
file, err := os.Create(outputPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
err = templ.Execute(file, struct {
|
||||
Theme themer.Theme
|
||||
}{
|
||||
Theme: t,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
* {
|
||||
/* Colors */
|
||||
background: {{ .Theme.Colors.Semantic.Background.RGBA 80 }};
|
||||
background-alt: {{ .Theme.Colors.Semantic.Surface.RGBA 80 }};
|
||||
background-bar: {{ .Theme.Colors.Semantic.SurfaceAlt.RGBA 80 }};
|
||||
foreground: {{ .Theme.Colors.Semantic.Text.Value }};
|
||||
foreground-alt: {{ .Theme.Colors.Semantic.Text.Value }};
|
||||
accent: {{ .Theme.Colors.Semantic.Accent.Value }};
|
||||
border: {{ .Theme.Colors.Semantic.Accent.Value }};
|
||||
border-alt: {{ .Theme.Colors.Semantic.Accent.Value }};
|
||||
selected: {{ .Theme.Colors.Semantic.SurfaceAlt.RGBA 80 }};
|
||||
urgent: {{ .Theme.Colors.Semantic.Warn.Value }};
|
||||
on-selected: {{ .Theme.Colors.Semantic.Text.Value }};
|
||||
separator: {{ .Theme.Colors.Semantic.Border.Value }};
|
||||
list-bg: {{ .Theme.Colors.Semantic.Background.RGBA 80 }};
|
||||
message-bg: {{ .Theme.Colors.Semantic.Surface.RGBA 80 }};
|
||||
error-bg: {{ .Theme.Colors.Semantic.Warn.Value }};
|
||||
error-border: {{ .Theme.Colors.Semantic.Border.Value }};
|
||||
|
||||
/* Standard Rofi variables for legacy support or internal use */
|
||||
normal-foreground: @foreground;
|
||||
normal-background: transparent;
|
||||
selected-normal-foreground: @on-selected;
|
||||
selected-normal-background: @selected;
|
||||
|
||||
urgent-foreground: @urgent;
|
||||
urgent-background: transparent;
|
||||
selected-urgent-foreground: @foreground;
|
||||
selected-urgent-background: @urgent;
|
||||
|
||||
active-foreground: @accent;
|
||||
active-background: transparent;
|
||||
selected-active-foreground: @on-selected;
|
||||
selected-active-background: @selected;
|
||||
|
||||
alternate-normal-foreground: @foreground;
|
||||
alternate-normal-background: transparent;
|
||||
alternate-urgent-foreground: @urgent;
|
||||
alternate-urgent-background: transparent;
|
||||
alternate-active-foreground: @accent;
|
||||
alternate-active-background: transparent;
|
||||
|
||||
/* Spacing, Padding, Margin */
|
||||
main-spacing: {{ .Theme.Spacing.MarginSmall }};
|
||||
main-padding: {{ .Theme.Spacing.PaddingLarge }};
|
||||
element-spacing: {{ .Theme.Spacing.MarginSmall }};
|
||||
element-padding: {{ .Theme.Spacing.PaddingSmall }};
|
||||
input-padding: {{ .Theme.Spacing.Padding }};
|
||||
message-margin: {{ .Theme.Spacing.MarginSmall }};
|
||||
|
||||
/* Borders and Radius */
|
||||
main-border: 1px;
|
||||
main-radius: {{ .Theme.Spacing.RadiusLarge }};
|
||||
element-border: 1px;
|
||||
element-radius: {{ .Theme.Spacing.RadiusSmall }};
|
||||
button-border: 1px;
|
||||
button-selected-border: 1px;
|
||||
button-selected-radius: {{ .Theme.Spacing.RadiusSmall }};
|
||||
list-border: 1px;
|
||||
list-radius: {{ .Theme.Spacing.RadiusSmall }};
|
||||
sidebar-border: 1px;
|
||||
}
|
||||
@@ -56,6 +56,17 @@ func (c Color) Alpha(bg Color, amount float64) string {
|
||||
return formatHexRGB(r, g, b)
|
||||
}
|
||||
|
||||
func (c Color) RGBA(alpha int) string {
|
||||
r, g, b, ok := parseHexRGB(c.Value)
|
||||
if !ok {
|
||||
return c.Value
|
||||
}
|
||||
if alpha < 100 {
|
||||
return "rgba ( " + strconv.Itoa(int(r)) + ", " + strconv.Itoa(int(g)) + ", " + strconv.Itoa(int(b)) + ", " + strconv.Itoa(alpha) + " % )"
|
||||
}
|
||||
return c.Value
|
||||
}
|
||||
|
||||
func (c *Color) UnmarshalText(text []byte) error {
|
||||
c.raw = strings.TrimSpace(string(text))
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user