Add dark theme icons

This commit is contained in:
daleclack 2023-10-13 22:52:53 +08:00
parent 000d599c71
commit 7507c7ac7f
18 changed files with 243 additions and 11 deletions

View File

@ -39,13 +39,28 @@ set(RESOURCE_LIST
icons/scalable/status/media-playlist-append.svg
icons/scalable/status/media-playlist-normal.svg
icons/scalable/status/media-playlist-play.svg
icons/scalable/status/media-playlist-repeat-one-symbolic.svg
icons/scalable/status/media-playlist-repeat-one.svg
icons/scalable/status/media-playlist-repeat.svg
icons/scalable/status/media-playlist-shuffle.svg
icons/scalable/status/media-seek-backward.svg
icons/scalable/status/media-seek-forward.svg
icons/scalable/status/media-skip-backward.svg
icons/scalable/status/media-skip-forward.svg
icons/scalable/status/media-eject-dark.svg
icons/scalable/status/media-mount-dark.svg
icons/scalable/status/media-playback-pause-dark.svg
icons/scalable/status/media-playback-start-dark.svg
icons/scalable/status/media-playback-stop-dark.svg
icons/scalable/status/media-playlist-append-dark.svg
icons/scalable/status/media-playlist-normal-dark.svg
icons/scalable/status/media-playlist-play-dark.svg
icons/scalable/status/media-playlist-repeat-one-dark.svg
icons/scalable/status/media-playlist-repeat-dark.svg
icons/scalable/status/media-playlist-shuffle-dark.svg
icons/scalable/status/media-seek-backward-dark.svg
icons/scalable/status/media-seek-forward-dark.svg
icons/scalable/status/media-skip-backward-dark.svg
icons/scalable/status/media-skip-forward-dark.svg
)
compile_gresources(RESOURCE_FILE

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 8 4 L 3 10 L 13 10 L 8 4 z M 3 11 L 3 12 L 13 12 L 13 11 L 3 11 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 404 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 3 4 L 8 10 L 13 4 L 3 4 z M 3 11 L 3 12 L 13 12 L 13 11 L 3 11 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 405 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 3 3 0 10 4 0 0 -10 z m 6 0 0 10 4 0 0 -10 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 382 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 3 3 0 10 10 -5 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 355 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 3 3 0 10 10 0 0 -10 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 360 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 3 2 A 1 1 0 0 0 2 3 A 1 1 0 0 0 3 4 A 1 1 0 0 0 4 3 A 1 1 0 0 0 3 2 z M 5 2 L 5 3 L 7 3 L 13 3 L 13 2 L 7 2 L 5 2 z M 5 4 L 5 5 L 7 5 L 11 5 L 11 4 L 7 4 L 5 4 z M 10 7 L 10 10 L 7 10 L 7 11 L 10 11 L 10 14 L 11 14 L 11 11 L 14 11 L 14 10 L 11 10 L 11 7 L 10 7 z M 3 8 A 1 1 0 0 0 2 9 A 1 1 0 0 0 3 10 A 1 1 0 0 0 4 9 A 1 1 0 0 0 3 8 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 674 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 16 5 L 16 7 L 3 7 L 3 8 L 16 8 L 16 10 L 19 7.5 L 16 5 z M 16 12 L 16 14 L 3 14 L 3 15 L 16 15 L 16 17 L 19 14.5 L 16 12 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 465 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 11 3 C 6.568002 3 3 6.568002 3 11 C 3 15.431998 6.568002 19 11 19 C 11.692084 19 12.360349 18.903948 13 18.740234 L 13 17.707031 C 12.366247 17.894565 11.696167 18 11 18 C 7.122001 18 4 14.877999 4 11 C 4 7.122001 7.122001 4 11 4 C 14.877999 4 18 7.122001 18 11 C 18 11.696167 17.894565 12.366247 17.707031 13 L 18.740234 13 C 18.903948 12.360349 19 11.692084 19 11 C 19 6.568002 15.431998 3 11 3 z M 10 5 L 10 12 L 11 12 L 16 12 L 16 11 L 11 11 L 11 5 L 10 5 z M 14 13 L 14 19 L 20 16 L 14 13 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 838 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 11 3.5 L 11 5 L 5 5 C 3.338 5 2 6.338 2 8 L 3 8 C 3 6.892 3.892 6 5 6 L 11 6 L 11 7.5 L 14 5.5 L 11 3.5 z M 13 8 C 13 9.108 12.108 10 11 10 L 5 10 L 5 8.5 L 2 10.5 L 5 12.5 L 5 11 L 11 11 C 12.662 11 14 9.662 14 8 L 13 8 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 561 B

View File

@ -0,0 +1,7 @@
<svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g fill="#dedede">
<path d="m3.994 2c-1.258 0.015-2.179-0.03-2.931 0.385a1.88 1.88 0 0 0-0.838 0.998c-0.165 0.437-0.225 0.96-0.225 1.617v6c0 0.658 0.06 1.179 0.225 1.617 0.164 0.439 0.461 0.79 0.838 0.998 0.752 0.416 1.673 0.37 2.931 0.385h8.012c1.258-0.015 2.179 0.03 2.932-0.385a1.88 1.88 0 0 0 0.838-0.998c0.164-0.438 0.224-0.96 0.224-1.617v-6c0-0.658-0.06-1.179-0.225-1.617a1.88 1.88 0 0 0-0.838-0.998c-0.752-0.416-1.673-0.37-2.931-0.385h-1.006v1h1c1.259 0.015 2.087 0.06 2.453 0.262 0.184 0.1 0.29 0.212 0.387 0.472s0.16 0.674 0.16 1.266v6c0 0.592-0.063 1.006-0.16 1.266-0.098 0.26-0.203 0.371-0.387 0.472-0.366 0.202-1.194 0.247-2.453 0.262h-8c-1.259-0.015-2.09-0.06-2.455-0.262-0.183-0.1-0.287-0.212-0.385-0.472-0.097-0.26-0.16-0.674-0.16-1.266v-6c0-0.592 0.063-1.006 0.16-1.266 0.098-0.26 0.202-0.371 0.385-0.472 0.365-0.202 1.195-0.247 2.455-0.262h2.5v-1h-2.502z" color="#000000" font-family="sans-serif" font-weight="400" overflow="visible" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none"/>
<path d="m5 0 1e-3 5c0.76-0.348 1.535-0.737 2.323-1.166a44.09 44.09 0 0 0 2.259-1.334 51.555 51.555 0 0 0-2.26-1.32 43.088 43.088 0 0 0-2.323-1.18z" color="#000000" overflow="visible"/>
<path d="m6.117 6.247c0.167-0.07 0.34-0.147 0.52-0.234 0.184-0.092 0.363-0.19 0.536-0.294a8.2 8.2 0 0 0 0.494-0.338c0.161-0.121 0.306-0.248 0.433-0.381h0.9v6h-1v-4.652c-0.448 0.347-1.012 0.566-1.494 0.762z" font-family="Ubuntu" font-weight="700" letter-spacing="0" text-anchor="middle" word-spacing="0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m11 3.5v1.5h-2c-1.662 0-3 1.338-3 3 0 1.108-.892 2-2 2h-2v1h2c1.662 0 3-1.338 3-3 0-1.108.892-2 2-2h2v1.5l3-2zm-9 1.5v1h2c.401 0 .772.119 1.084.32.077-.333.21-.642.387-.922-.436-.246-.933-.398-1.471-.398zm9 3.5v1.5h-2c-.401 0-.772-.119-1.084-.32-.077.333-.21.642-.387.922.436.246.933.398 1.471.398h2v1.5l3-2z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 644 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 11 4 4 11 11 18 11,11 Z M 11 11 l 7 7 0 -14 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 4 4 0 14 L 11 11 Z M 11 11 11 18 18 11 11 4 Z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 4 4 0 14 5 0 0 -7 0 -7 z M 9 11 l 9 7 0 -14 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#dedede;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 4 4 0 14 L 13 11 Z M 13 11 l 0 7 5 0 0 -14 -5 0 z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 387 B

View File

@ -346,6 +346,26 @@ static void my_media_player_expander_activate(GtkExpander *self, MyMediaPlayer *
}
}
// Set button icon name with dark icon theme support
static void player_button_set_icon_name(GtkButton *button, const char *icon_name,
gboolean dark_mode)
{
char *icon_name1;
// Change icon name string for dark mode
if (dark_mode)
{
icon_name1 = g_strdup_printf("%s-dark", icon_name);
}
else
{
icon_name1 = g_strdup_printf("%s", icon_name);
}
// Set icon name and free memory for icon name
gtk_button_set_icon_name(button, icon_name1);
g_free(icon_name1);
}
// Play button
static void btnplay_clicked(GtkButton *self, MyMediaPlayer *player)
{
@ -357,13 +377,13 @@ static void btnplay_clicked(GtkButton *self, MyMediaPlayer *player)
{
// Media is playing, pause it
gtk_media_stream_pause(stream);
gtk_button_set_icon_name(self, "media-playback-start");
player_button_set_icon_name(self, "media-playback-start", player->dark_mode);
}
else
{
// Media is not playing
gtk_media_stream_play(stream);
gtk_button_set_icon_name(self, "media-playback-pause");
player_button_set_icon_name(self, "media-playback-pause", player->dark_mode);
}
}
}
@ -394,7 +414,8 @@ static void btnstop_clicked(GtkButton *self, MyMediaPlayer *player)
GtkMediaStream *stream = gtk_video_get_media_stream(GTK_VIDEO(player->video));
gtk_media_file_clear(GTK_MEDIA_FILE(stream));
gtk_video_set_file(GTK_VIDEO(player->video), NULL);
gtk_button_set_icon_name(GTK_BUTTON(player->btn_play), "media-playback-start");
player_button_set_icon_name(GTK_BUTTON(player->btn_play), "media-playback-start",
player->dark_mode);
gtk_widget_set_sensitive(player->btn_play, FALSE);
}
@ -406,19 +427,19 @@ static void btn_playmode_clicked(GtkButton *self, MyMediaPlayer *player)
{
case PlayMode::List_Once:
player->current_play_mode = PlayMode::List_Repeat;
gtk_button_set_icon_name(self, "media-playlist-repeat");
player_button_set_icon_name(self, "media-playlist-repeat", player->dark_mode);
break;
case PlayMode::List_Repeat:
player->current_play_mode = PlayMode::List_Shuffle;
gtk_button_set_icon_name(self, "media-playlist-shuffle");
player_button_set_icon_name(self, "media-playlist-shuffle", player->dark_mode);
break;
case PlayMode::List_Shuffle:
player->current_play_mode = PlayMode::One_Repeat;
gtk_button_set_icon_name(self, "media-playlist-repeat-one-symbolic");
player_button_set_icon_name(self, "media-playlist-repeat-one", player->dark_mode);
break;
case PlayMode::One_Repeat:
player->current_play_mode = PlayMode::List_Once;
gtk_button_set_icon_name(self, "media-playlist-normal");
player_button_set_icon_name(self, "media-playlist-normal", player->dark_mode);
break;
}
}
@ -444,18 +465,19 @@ static gboolean my_media_player_check_dark_theme(MyMediaPlayer *player)
theme_name_length = strlen(theme_name);
// Translate string to lower
for(int i = 0; i < theme_name_length; i++)
for (int i = 0; i < theme_name_length; i++)
{
theme_name[i] = tolower(theme_name[i]);
}
// Check "dark" string
for(int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
temp_string[i] = theme_name[theme_name_length - 4 + i];
}
if(strncmp(temp_string, "dark", 4) == 0){
if (strncmp(temp_string, "dark", 4) == 0)
{
dark_mode = TRUE;
}
free(theme_name);