me

/

vendetta Public
17 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

change default theme

diviocity committed last Nov 8 · 40396359bc0b3e9d30780f6de625880404bba2c4 View patch
Unverified signature 4 files changed +51 -46
AGENTS.md +6 -6

@@ -374,7 +374,7 @@ render pump, the relay, the control bar geometry and its build).

374374

375375### 6.1 Public surface

376376

377-- `Palette` — the strip colours, all defaulting to the vinix-dark constants;

377+- `Palette` — the strip colours, all defaulting to the vendetta constants;

378378 a host can restyle the widget wholesale by assigning `Player.palette`,

379379 and `bg_docked` styles the static docked strip separately from the floating

380380 one (which keeps `bg_dark`).

@@ -1126,8 +1126,8 @@ mpv defaults, which themes can restyle via `apply_mpv_colors`'s

11261126Theme files are `~/.config/vendetta/themes/<name>.toml` with a single

11271127`[colors]` table; every value accepts `0x...`, `#...` or a bare hex string

11281128(`theme_color`) and anything missing/malformed keeps the built-in

1129-vinix-dark value (a file of the default's name merely overlays it). The

1130-available list is always `[vinix-dark, ...sorted files]`.

1129+vendetta value (a file of the default's name merely overlays it). The

1130+available list is always `[vendetta, ...sorted files]`.

11311131

11321132`set_theme` swaps `theme` + widget `palette` + the nine `ui2.set_menu_bar_*`

11331133globals + the mpv colours — the same composer live edits reuse.

@@ -1146,7 +1146,7 @@ palette, menus, mpv colours — the whole window previews while you drag).

11461146`overlay_opacity` is the one non-colour value: the editor's slider sets it, and

11471147it fills the panels over the video (dialogs, settings, statistics, the seek

11481148preview). The scrims stay 0.45. Files carry it as `[opacity] overlay`, and a

1149-file without it keeps 0.8.

1149+file without it keeps the built-in 0.85 (the vendetta theme's value).

11501150Save writes the current values as a fresh `[colors]` TOML under the edited

11511151name, validates like every other name field, and makes it current.

11521152

@@ -1438,8 +1438,8 @@ A theme file sample:

14381438

14391439```toml

14401440[colors]

1441-bg_dark = 0x020617

1442-btn_primary = 0x3b82f6

1441+bg_dark = 0x000000

1442+btn_primary = 0x2775f1

14431443...

14441444```

14451445

libvendetta/lib.v +13 -12

@@ -25,16 +25,18 @@ import ui2

2525import wake

2626import x.progress

2727

28-// The vinix-dark palette vendetta compiles in, so the widget reads like the

28+// The vendetta palette vendetta compiles in, so the widget reads like the

2929// standalone player without a theme file system behind it.

30-const slider_track_dark = 0x334155

31-const slider_value_blue = 0x3b82f6

32-const btn_blue = 0x3b82f6

33-const btn_secondary_slate = 0x64748b

30+const slider_track_dark = 0x091029

31+const slider_value_blue = 0x2775f1

32+const btn_blue = 0x2775f1

33+const btn_secondary_slate = 0x06061d

3434const text_main_white = u32(0xffffff)

3535const text_muted_slate = 0xe2e8f0

36-const bg_dark_night = 0x020617

37-const bg_surface_slate = 0x1e293b

36+const bg_dark_night = 0x000000

37+const bg_surface_slate = 0x000000

38+const btn_seek_dark = 0x06061d

39+const btn_mute_dark = 0x000000

3840

3941// smooth_glide_cap bounds how far the smooth bar's glide may run ahead of the

4042// last reported position, in seconds: a decoder that stalls its reports stops

@@ -50,12 +52,11 @@ pub mut:

5052 btn_primary u32 = btn_blue

5153 btn_secondary u32 = btn_secondary_slate

5254 // The control strip's buttons: the play/pause toggle, the seek steps and

53- // the mute toggle. They default to the strip's backdrop, so the glyphs

54- // sit on the bar without boxes of their own; each keeps a field so a

55- // host can split them apart again.

55+ // the mute toggle. Each keeps a field so a host can give it its own box;

56+ // the defaults are the vendetta theme's strip.

5657 btn_play u32 = btn_blue

57- btn_seek u32 = bg_dark_night

58- btn_mute u32 = bg_dark_night

58+ btn_seek u32 = btn_seek_dark

59+ btn_mute u32 = btn_mute_dark

5960 text_main u32 = text_main_white

6061 text_muted u32 = text_muted_slate

6162 bg_dark u32 = bg_dark_night

src/main.v +1 -1

@@ -61,7 +61,7 @@ examples:

6161// file list.

6262struct Config {

6363 show_help bool @[long: help; short: h; xdoc: 'Show this help text and exit']

64- theme string @[xdoc: 'Theme file, without .toml, from ~/.config/vendetta/themes (default: the saved theme, else vinix-dark)']

64+ theme string @[xdoc: 'Theme file, without .toml, from ~/.config/vendetta/themes (default: the saved theme, else vendetta)']

6565 volume f64 = -1 @[xdoc: 'Initial volume, 0 to 100 (default: the saved volume)']

6666 mute bool @[xdoc: 'Start muted']

6767 speed f64 = -1 @[xdoc: 'Playback speed, 0.01 to 100 (default: the saved speed)']

src/theme.v +31 -27

@@ -8,41 +8,44 @@ import libvendetta.mpv

88

99// default_theme_name is the built-in theme. It is always offered, even with no

1010// theme files, and a theme file of the same name only overlays its colours.

11-const default_theme_name = 'vinix-dark'

11+const default_theme_name = 'vendetta'

1212

13-// The built-in colour palette, the values the vinix-dark theme writes out.

14-const slider_track_dark = 0x334155

15-const slider_value_blue = 0x3b82f6

13+// The built-in colour palette, the values the vendetta theme writes out.

14+const slider_track_dark = 0x091029

15+const slider_value_blue = 0x2775f1

1616

17-const btn_blue = 0x3b82f6 // ui2 primary (buttons, value track)

18-const btn_secondary = 0x64748b // ui2 muted slate (seek buttons)

17+const btn_blue = 0x2775f1 // ui2 primary (buttons, value track)

18+const btn_secondary = 0x06061d // near-black secondary (seek buttons)

1919

2020// The control strip's buttons: the play/pause toggle, the seek steps and the

21-// mute toggle. They default to the strip's own backdrop (bg_dark), so the

22-// glyphs sit on the bar without boxes of their own; each keeps a key so a

23-// theme can split them apart again.

21+// mute toggle. Each keeps a key so a theme can give it its own box; the

22+// defaults are the vendetta theme's strip.

2423const btn_play = btn_blue

25-const btn_seek = bg_dark

26-const btn_mute = bg_dark

24+const btn_seek = 0x06061d

25+const btn_mute = 0x000000

2726const text_main = u32(0xffffff) // pure white (labels, button glyphs)

2827const text_muted = 0xe2e8f0 // very light slate (stats body, time labels)

29-const bg_dark = 0x020617 // near-black media control bg

30-const bg_surface = 0x1e293b // ui2 surface (dialogs, overlay, preview popup)

28+const bg_dark = 0x000000 // near-black media control bg

29+const bg_surface = 0x000000 // ui2 surface (dialogs, overlay, preview popup)

3130

3231// The menu bar's colours: the bar strip, its underline and the open panels'

3332// outline, the titles and row labels, the disabled rows and the shortcuts

3433// beside them, the hover and open highlight, and the open panel's background,

3534// shadow and separators. ui2 ships a light bar for hosts that want one;

36-// vinix-dark overrides all nine so the bar sits in the dark chrome with it.

37-const menu_bg = u32(0x1e293b)

38-const menu_border = u32(0x334155)

39-const menu_text = u32(0xe2e8f0)

40-const menu_disabled = u32(0x64748b)

41-const menu_shortcut = u32(0x94a3b8)

42-const menu_highlight = u32(0x334155)

43-const menu_panel = u32(0x1e293b)

44-const menu_shadow = u32(0x020617)

45-const menu_separator = u32(0x334155)

35+// vendetta overrides all nine so the bar sits in the black chrome with it.

36+const menu_bg = u32(0x000000)

37+const menu_border = u32(0x000000)

38+const menu_text = u32(0xbbbbbb)

39+const menu_disabled = u32(0x3e3e3e)

40+const menu_shortcut = u32(0x958c83)

41+const menu_highlight = u32(0x2775f1)

42+const menu_panel = u32(0x000000)

43+const menu_shadow = u32(0x000000)

44+const menu_separator = u32(0x000000)

45+

46+// How much of the video the floating panels hide, the vendetta theme's value;

47+// a theme file without an [opacity] table keeps it.

48+const default_overlay_opacity = 0.85

4649

4750// The text fields' backdrop and the dialog scrim, plus the OSD and subtitle

4851// colours mpv draws over the video. The first two keep the values the views

@@ -56,7 +59,7 @@ const sub_text = u32(0xffffff)

5659const sub_border = u32(0x000000)

5760

5861// Theme is every colour the window paints. A theme file can replace any of

59-// them; whatever it leaves out keeps the built-in vinix-dark values.

62+// them; whatever it leaves out keeps the built-in vendetta values.

6063struct Theme {

6164mut:

6265 slider_track u32

@@ -98,8 +101,9 @@ mut:

98101 sub_text u32

99102 sub_border u32

100103 // How much of the video the panels floating over it hide, 0 to 1: dialogs,

101- // settings, the statistics popup and the seek preview.

102- overlay_opacity f64 = 0.8

104+ // settings, the statistics popup and the seek preview. The default is the

105+ // vendetta theme's value.

106+ overlay_opacity f64 = default_overlay_opacity

103107}

104108

105109// default_theme is the theme that is compiled into vendetta.

@@ -146,7 +150,7 @@ fn theme_dir() string {

146150}

147151

148152// theme_color reads one colour out of a theme table. It accepts a TOML

149-// integer (0x334155) or a string ('334155', '#334155', '0x334155'); anything

153+// integer (0x091029) or a string ('091029', '#091029', '0x091029'); anything

150154// else, or a missing key, keeps the fallback value.

151155fn theme_color(table toml.Any, key string, fallback u32) u32 {

152156 val := table.value_opt(key) or { return fallback }