Skip to content

Commit 90a1b16

Browse files
authored
Merge pull request #188 from Samillion/dev_wincontrols_hover
feat: add hover color options for window controls
2 parents 0477409 + bf0fdcd commit 90a1b16

File tree

4 files changed

+40
-30
lines changed

4 files changed

+40
-30
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A sleek and modern OSC for [mpv](https://mpv.io/), this project is a fork of ModernX designed to enhance functionality by adding more features, all while preserving the core standards of mpv's OSC.
44

5-
![modernz-osc](https://github.com/user-attachments/assets/b642c5b6-b9cb-423e-af4f-c1772652853b)
5+
![modernz-osc](https://github.com/user-attachments/assets/2f00a1c8-6770-45d4-9758-7962ae2deb31)
66

77
<p align="center">
88
<a href="#installation"><strong>Installation »</strong></a>
@@ -193,6 +193,7 @@ For even more useful scripts, check out the [mpv User Scripts Wiki](https://gith
193193

194194
- To add many features in: [Color Customization](docs/USER_OPTS.md#colors-and-style), [Options](docs/USER_OPTS.md) and [Locale Integration](docs/TRANSLATIONS.md)
195195
- To integrate console and select into the osc, which inspired mpv to apply it in the stock osc. [ref [#1](https://github.com/mpv-player/mpv/pull/15016), [#2](https://github.com/mpv-player/mpv/pull/15031)]
196+
- To add a dedicated layout for images. [[details](/docs/IMAGE_VIEWER.md)]
196197
- To re-do the project entirely to match mpv's stock osc standards, to ensure compatibility
197198
- To eliminate old bugs and redundancy within the code
198199

docs/USER_OPTS.md

+24-22
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,30 @@ Create `modernz.conf` in your mpv script-opts directory:
108108

109109
### Colors and style
110110

111-
| Option | Value | Description |
112-
| -------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
113-
| osc_color | `#000000` | accent color of the OSC and title bar |
114-
| window_title_color | `#FFFFFF` | color of the title in borderless/fullscreen mode |
115-
| window_controls_color | `#FFFFFF` | color of the window controls (close, minimize, maximize) in borderless/fullscreen mode |
116-
| title_color | `#FFFFFF` | color of the title (above seekbar) |
117-
| seekbarfg_color | `#BE4D25` | color of the seekbar progress and handle |
118-
| seekbarbg_color | `#FFFFFF` | color of the remaining seekbar |
119-
| seekbar_cache_color | `#BE254A` | color of the cache ranges on the seekbar |
120-
| volumebar_match_seek_color | no | match volume bar color with seekbar color (ignores `side_buttons_color`) |
121-
| time_color | `#FFFFFF` | color of the timestamps (below seekbar) |
122-
| chapter_title_color | `#FFFFFF` | color of the chapter title next to timestamp (below seekbar) |
123-
| side_buttons_color | `#FFFFFF` | color of the side buttons (audio, subtitles, playlist, etc.) |
124-
| middle_buttons_color | `#FFFFFF` | color of the middle buttons (skip, jump, chapter, etc.) |
125-
| playpause_color | `#FFFFFF` | color of the play/pause button |
126-
| held_element_color | `#999999` | color of the element when held down (pressed) |
127-
| hover_effect_color | `#CB7050` | color of a hovered button when `hover_effect` includes `"color"` |
128-
| thumbnail_border_color | `#111111` | color of the border for thumbnails (with thumbfast) |
129-
| fade_alpha | 150 | alpha of the OSC background box |
130-
| fade_blur_strength | 100 | blur strength for the OSC alpha fade. caution: high values can take a lot of CPU time to render |
131-
| window_fade_alpha | 75 | alpha of the window title bar |
132-
| thumbnail_border | 2 | width of the thumbnail border (for thumbfast) |
111+
| Option | Value | Description |
112+
| --------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
113+
| osc_color | `#000000` | accent color of the OSC and title bar |
114+
| window_title_color | `#FFFFFF` | color of the title in borderless/fullscreen mode |
115+
| window_controls_color | `#FFFFFF` | color of the window controls (close, minimize, maximize) in borderless/fullscreen mode |
116+
| windowcontrols_close_hover | `#E81123` | color of close window control on hover |
117+
| windowcontrols_minmax_hover | `#FFD700` | color of min/max window controls on hover |
118+
| title_color | `#FFFFFF` | color of the title (above seekbar) |
119+
| seekbarfg_color | `#BE4D25` | color of the seekbar progress and handle |
120+
| seekbarbg_color | `#FFFFFF` | color of the remaining seekbar |
121+
| seekbar_cache_color | `#BE254A` | color of the cache ranges on the seekbar |
122+
| volumebar_match_seek_color | no | match volume bar color with seekbar color (ignores `side_buttons_color`) |
123+
| time_color | `#FFFFFF` | color of the timestamps (below seekbar) |
124+
| chapter_title_color | `#FFFFFF` | color of the chapter title next to timestamp (below seekbar) |
125+
| side_buttons_color | `#FFFFFF` | color of the side buttons (audio, subtitles, playlist, etc.) |
126+
| middle_buttons_color | `#FFFFFF` | color of the middle buttons (skip, jump, chapter, etc.) |
127+
| playpause_color | `#FFFFFF` | color of the play/pause button |
128+
| held_element_color | `#999999` | color of the element when held down (pressed) |
129+
| hover_effect_color | `#FFFFFF` | color of a hovered button when `hover_effect` includes `"color"` |
130+
| thumbnail_border_color | `#111111` | color of the border for thumbnails (with thumbfast) |
131+
| fade_alpha | 150 | alpha of the OSC background box |
132+
| fade_blur_strength | 100 | blur strength for the OSC alpha fade. caution: high values can take a lot of CPU time to render |
133+
| window_fade_alpha | 75 | alpha of the window title bar |
134+
| thumbnail_border | 2 | width of the thumbnail border (for thumbfast) |
133135

134136
### Button hover effects
135137

modernz.conf

+4
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ osc_color=#000000
157157
window_title_color=#FFFFFF
158158
# color of the window controls (close, minimize, maximize) in borderless/fullscreen mode
159159
window_controls_color=#FFFFFF
160+
# color of close window control on hover
161+
windowcontrols_close_hover=#E81123
162+
# color of min/max window controls on hover
163+
windowcontrols_minmax_hover=#FFD700
160164
# color of the title (above seekbar)
161165
title_color=#FFFFFF
162166
# color of the seekbar progress and handle

modernz.lua

+10-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ local user_opts = {
2222
-- Language and display
2323
language = "en", -- set language (for available options, see: https://github.com/Samillion/ModernZ/blob/main/docs/TRANSLATIONS.md)
2424
font = "mpv-osd-symbols", -- font for the OSC (default: mpv-osd-symbols or the one set in mpv.conf)
25-
25+
2626
idlescreen = true, -- show mpv logo when idle
2727
windowcontrols = "auto", -- show OSC window controls: "auto", "yes", or "no"
2828
showwindowed = true, -- show OSC when windowed
@@ -49,7 +49,7 @@ local user_opts = {
4949
show_title = true, -- show title in the OSC (above seekbar)
5050
title = "${media-title}", -- title above seekbar format: "${media-title}" or "${filename}"
5151
title_font_size = 30, -- font size of the title text (above seekbar)
52-
52+
5353
show_chapter_title = true, -- show chapter title alongside timestamp (below seekbar)
5454
chapter_fmt = "%s", -- format for chapter display on seekbar hover (set to "no" to disable)
5555

@@ -111,6 +111,8 @@ local user_opts = {
111111
osc_color = "#000000", -- accent color of the OSC and title bar
112112
window_title_color = "#FFFFFF", -- color of the title in borderless/fullscreen mode
113113
window_controls_color = "#FFFFFF", -- color of the window controls (close, minimize, maximize) in borderless/fullscreen mode
114+
windowcontrols_close_hover = "#E81123", -- color of close window control on hover
115+
windowcontrols_minmax_hover = "#FFD700", -- color of min/max window controls on hover
114116
title_color = "#FFFFFF", -- color of the title (above seekbar)
115117
seekbarfg_color = "#BE4D25", -- color of the seekbar progress and handle
116118
seekbarbg_color = "#FFFFFF", -- color of the remaining seekbar
@@ -146,7 +148,7 @@ local user_opts = {
146148
seekrangealpha = 150, -- transparency of the seek range
147149
livemarkers = true, -- update chapter markers on the seekbar when duration changes
148150
seekbarkeyframes = false, -- use keyframes when dragging the seekbar
149-
151+
150152
automatickeyframemode = true, -- automatically set keyframes for the seekbar based on video length
151153
automatickeyframelimit = 600, -- videos longer than this (in seconds) will have keyframes on the seekbar
152154

@@ -1500,7 +1502,7 @@ local function window_controls()
15001502
lo = add_layout("close")
15011503
lo.geometry = third_geo
15021504
lo.style = osc_styles.window_control
1503-
lo.button.hoverstyle = "{\\c&H2311E8&}"
1505+
lo.button.hoverstyle = "{\\c&H" .. osc_color_convert(user_opts.windowcontrols_close_hover) .. "&}"
15041506

15051507
-- Minimize: 🗕
15061508
ne = new_element("minimize", "button")
@@ -1509,7 +1511,7 @@ local function window_controls()
15091511
lo = add_layout("minimize")
15101512
lo.geometry = first_geo
15111513
lo.style = osc_styles.window_control
1512-
lo.button.hoverstyle = "{\\c&H00D7FF&}" -- gold
1514+
lo.button.hoverstyle = "{\\c&H" .. osc_color_convert(user_opts.windowcontrols_minmax_hover) .. "&}"
15131515

15141516
-- Maximize: 🗖 /🗗
15151517
ne = new_element("maximize", "button")
@@ -1524,7 +1526,7 @@ local function window_controls()
15241526
lo = add_layout("maximize")
15251527
lo.geometry = second_geo
15261528
lo.style = osc_styles.window_control
1527-
lo.button.hoverstyle = "{\\c&H00D7FF&}" -- gold
1529+
lo.button.hoverstyle = "{\\c&H" .. osc_color_convert(user_opts.windowcontrols_minmax_hover) .. "&}"
15281530
end
15291531

15301532
-- Window Title
@@ -3439,7 +3441,8 @@ local function validate_user_opts()
34393441
user_opts.title_color, user_opts.time_color, user_opts.side_buttons_color,
34403442
user_opts.middle_buttons_color, user_opts.playpause_color, user_opts.window_title_color,
34413443
user_opts.window_controls_color, user_opts.held_element_color, user_opts.thumbnail_border_color,
3442-
user_opts.chapter_title_color, user_opts.seekbar_cache_color, user_opts.hover_effect_color
3444+
user_opts.chapter_title_color, user_opts.seekbar_cache_color, user_opts.hover_effect_color,
3445+
user_opts.windowcontrols_close_hover, user_opts.windowcontrols_minmax_hover
34433446
}
34443447

34453448
for _, color in pairs(colors) do

0 commit comments

Comments
 (0)