Refactor Hyprland configs, introduce Sithego for theming, and add supporting scripts

This commit is contained in:
2026-02-17 20:42:41 +01:00
parent c57ef06442
commit 8b153d54ac
60 changed files with 1896 additions and 76 deletions
@@ -0,0 +1,112 @@
package intellij
import (
"Sithego/themer"
"os"
"os/exec"
"path/filepath"
"strings"
"text/template"
)
type Adapter struct {
OutputDir string
}
type Option func(*Adapter)
func WithOutputDir(dir string) Option {
abs, err := filepath.Abs(dir)
if err != nil {
panic(err)
}
return func(a *Adapter) {
a.OutputDir = abs
}
}
func New(opt ...Option) *Adapter {
home, _ := os.UserHomeDir()
a := &Adapter{
OutputDir: home + "/.themes/",
}
for _, o := range opt {
o(a)
}
return a
}
func (a *Adapter) Name() string {
return "IntelliJ"
}
func (a *Adapter) Generate(t themer.Theme) error {
// 1. Create temporary directory structure for JAR bundling
tmpDir, err := os.MkdirTemp("", "intellij-theme-*")
if err != nil {
return err
}
defer func(path string) {
err := os.RemoveAll(path)
if err != nil {
}
}(tmpDir)
metaInfDir := filepath.Join(tmpDir, "META-INF")
if err := os.MkdirAll(metaInfDir, 0775); err != nil {
return err
}
funcMap := template.FuncMap{
"lower": strings.ToLower,
}
// 2. Generate plugin.xml
pluginTempl := template.New("template.plugin.xml").Funcs(funcMap)
pluginTempl, err = pluginTempl.ParseFiles("themer/adapters/intellij/template.plugin.xml")
if err != nil {
return err
}
pluginFile, err := os.Create(filepath.Join(metaInfDir, "plugin.xml"))
if err != nil {
return err
}
if err := pluginTempl.Execute(pluginFile, struct{ Theme themer.Theme }{Theme: t}); err != nil {
_ = pluginFile.Close()
return err
}
_ = pluginFile.Close()
// 3. Generate .theme.json
themeTempl, err := template.ParseFiles("themer/adapters/intellij/template.theme.json")
if err != nil {
return err
}
themeName := t.Meta.Name + ".theme.json"
themeFile, err := os.Create(filepath.Join(tmpDir, themeName))
if err != nil {
return err
}
if err := themeTempl.Execute(themeFile, struct{ Theme themer.Theme }{Theme: t}); err != nil {
_ = themeFile.Close()
return err
}
_ = themeFile.Close()
// 4. Bundle everything into a JAR (using zip)
jarName := t.Meta.Name + ".jar"
outputDir := filepath.Join(a.OutputDir, t.Meta.Name, "intellij")
if err := os.MkdirAll(outputDir, 0775); err != nil {
return err
}
jarPath := filepath.Join(outputDir, jarName)
_ = os.Remove(jarPath) // Remove old JAR if exists
cmd := exec.Command("zip", "-r", jarPath, ".")
cmd.Dir = tmpDir
if err := cmd.Run(); err != nil {
return err
}
return nil
}
@@ -0,0 +1,16 @@
<idea-plugin>
<id>de.arindy.{{ .Theme.Meta.Name | lower }}</id>
<name>{{ .Theme.Meta.Name }} Theme</name>
<version>{{ .Theme.Meta.Version }}</version>
<vendor email="support@mail.arindy.de">Arindy</vendor>
<description><![CDATA[
Custom theme generated by Sithego for {{ .Theme.Meta.Name }}.
]]></description>
<depends>com.intellij.modules.platform</depends>
<extensions defaultExtensionNs="com.intellij">
<themeProvider id="de.arindy.{{ .Theme.Meta.Name | lower }}" path="/{{ .Theme.Meta.Name }}.theme.json"/>
</extensions>
</idea-plugin>
@@ -0,0 +1,91 @@
{
"name": "{{ .Theme.Meta.Name }}",
"dark": {{ if eq .Theme.Meta.Type "dark" }}true{{ else }}false{{ end }},
"parentTheme": "Islands Dark",
"author": "Arindy",
"colors": {
"ScrollBar.thumb": "{{ .Theme.Colors.Semantic.Border.Value }}",
"ScrollBar.track": "{{ .Theme.Colors.Semantic.Background.Value }}",
"ScrollBar.hoverThumb": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"ScrollBar.hoverTrack": "{{ .Theme.Colors.Semantic.Surface.Value }}"
},
"ui": {
"*": {
"background": "{{ .Theme.Colors.Semantic.Background.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"selectionBackground": "{{ .Theme.Colors.Semantic.Accent.Alpha .Theme.Colors.Semantic.Background 0.3 }}",
"selectionForeground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"focusColor": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"borderColor": "{{ .Theme.Colors.Semantic.Border.Value }}",
"disabledBackground": "{{ .Theme.Colors.Semantic.Background.Value }}",
"disabledForeground": "{{ .Theme.Colors.Semantic.Disabled.Value }}"
},
"Button": {
"startBackground": "{{ .Theme.Colors.Semantic.SurfaceAlt.Value }}",
"endBackground": "{{ .Theme.Colors.Semantic.SurfaceAlt.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"focusedBorderColor": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"default": {
"startBackground": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"endBackground": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Background.Value }}",
"focusedBorderColor": "{{ .Theme.Colors.Semantic.Accent.Value }}"
}
},
"ComboBox": {
"modifiedItemForeground": "{{ .Theme.Colors.Semantic.Accent.Value }}"
},
"List": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"selectionBackground": "{{ .Theme.Colors.Semantic.Accent.Alpha .Theme.Colors.Semantic.Background 0.3 }}",
"selectionForeground": "{{ .Theme.Colors.Semantic.Text.Value }}"
},
"Menu": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"selectionBackground": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"selectionForeground": "{{ .Theme.Colors.Semantic.Background.Value }}"
},
"MenuBar": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"selectionBackground": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"selectionForeground": "{{ .Theme.Colors.Semantic.Background.Value }}"
},
"Panel": {
"background": "{{ .Theme.Colors.Semantic.Background.Value }}"
},
"SidePanel": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}"
},
"TabbedPane": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"underlineColor": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"hoverColor": "{{ .Theme.Colors.Semantic.SurfaceAlt.Value }}"
},
"Table": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"gridColor": "{{ .Theme.Colors.Semantic.Border.Value }}"
},
"TextField": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"foreground": "{{ .Theme.Colors.Semantic.Text.Value }}",
"caretColor": "{{ .Theme.Colors.Semantic.Accent.Value }}"
},
"ToolWindow": {
"Header": {
"background": "{{ .Theme.Colors.Semantic.Surface.Value }}",
"inactiveBackground": "{{ .Theme.Colors.Semantic.Background.Value }}"
},
"Button": {
"selectedBackground": "{{ .Theme.Colors.Semantic.Accent.Value }}",
"selectedForeground": "{{ .Theme.Colors.Semantic.Background.Value }}"
}
},
"Tree": {
"rowHeight": 24,
"selectionBackground": "{{ .Theme.Colors.Semantic.Accent.Alpha .Theme.Colors.Semantic.Background 0.3 }}",
"selectionForeground": "{{ .Theme.Colors.Semantic.Text.Value }}"
}
}
}