From 7f284bce27bff64fba7559719feb1ab694bf495b Mon Sep 17 00:00:00 2001 From: niksedk Date: Thu, 6 Jul 2023 18:25:19 +0200 Subject: [PATCH] Minor gfx theme adjustments --- Icons/DarkTheme/VideoPlayer/MuteDown.png | Bin 3125 -> 3104 bytes src/ui/Controls/VideoPlayerContainer.cs | 65 +++++++++++++++-------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/Icons/DarkTheme/VideoPlayer/MuteDown.png b/Icons/DarkTheme/VideoPlayer/MuteDown.png index 4a5088acdfa8b46bd8c7a648d9d4f518f9588722..9a018744f95f569d2387a4618a831e2f8530b829 100644 GIT binary patch delta 905 zcmdlgu|Q%&1T&Xeh=HXQ5E)rcPGVL@=JqoOsH7OAr6rrB8R;4%rI_eiq?)AZCK)6p z>86+_8zh<-m?aunnoVYA(NeLrv`jHHOfuFrHcCy^H83VPIg=_jGX# zvFM#T**E)>gGg)sACC)}b2*kJ3QRUzu=S|UmXf8@yzYMEFITM4j%M6ctP1(06-LhEzoNf6#j#r$RL9y3MWA9rQueq7CE=;>6VE_H+ zSJTtecVA;-NVr|L_~MQ7XA#?P-!<<%{+OSifBN+4_VXkj`>0Jmn`V2y+eJxSTzvD* zGn;h0G#Lb(%I2MZ8YIxNdiCmq2^-?pGcyzv7b|;Ss<8R@=g*zI?d9d=`_3>V)JwEw z&Z^O9OZ-#9%`oLs*y^vJJ_W75y6yJchX)uGrk`#-{P1DH3?H@nlXGikMz0mKm*;D@ zd6i?aE#k^hAoKjmlPCH`@<4yDT2KV%$P%OrvLNj&v)PbHaVvGV8h`>8ddYIzyB_oEOW26=dnur;)@!JDMm9t{6Co(3v}%J o_wWDB`9EdVs+T3de*XL^9r0Q2evxQfAp;P2y85}Sb4q9e08SNrjQ{`u delta 883 zcmZ1=u~lM21T&Xuh@q*Ksgaeb#pEPrWn^wYbAXDWiIIVEa$=gUfswJ9u4ST$k#3@4 znxSr@nW3Rsl4W9IlBvmLW)>|K3j<5bl%y0RT?^AxOWkB66BAv_lr$hKHO(T~z{1qb zA}x7yAd3)_ilLdQk!f8?}s7!=oCZA@NM$$M-nF!k^b8()oU$$HfYh(+(z%eEP>0z}w9 zTuxgRvOd_?@z0uI$EA&IRvKLjFIFgV_!Yi<@MuAVjCK%?n`T0HWUbn>|TF*aQ{z;Eb+kDe)v18zsm-|bs z?!Nvy>16$r%E;AM85Aa;lzCWU^|ru5ZF1+u3>)pvuT{DnO{bq0?Tl$s@R+nEeP>Lb z-TcWaCpYQ5tE;Fuz{^m;$zXH-vGQB>vS!uvAciz^lAO;bEO)0X}3RM00K`}KbLh*2~7YOgl= _panelControls.Height - 4) @@ -1306,16 +1305,16 @@ namespace Nikse.SubtitleEdit.Controls public void ShowFullScreenControls() { - _pictureBoxFullscreen.Image = (Image)_bitmapNoFullscreen; - _pictureBoxFullscreenDown.Image = (Image)_bitmapNoFullscreenDown; - _pictureBoxFullscreenOver.Image = (Image)_bitmapNoFullscreenOver; + _pictureBoxFullscreen.Image = _bitmapNoFullscreen; + _pictureBoxFullscreenDown.Image = _bitmapNoFullscreenDown; + _pictureBoxFullscreenOver.Image = _bitmapNoFullscreenOver; } public void ShowNonFullScreenControls() { - _pictureBoxFullscreen.Image = (Image)_bitmapFullscreen; - _pictureBoxFullscreenDown.Image = (Image)_bitmapFullscreenDown; - _pictureBoxFullscreenOver.Image = (Image)_bitmapFullscreenOver; + _pictureBoxFullscreen.Image = _bitmapFullscreen; + _pictureBoxFullscreenDown.Image = _bitmapFullscreenDown; + _pictureBoxFullscreenOver.Image = _bitmapFullscreenOver; } private void PictureBoxFullscreenMouseEnter(object sender, EventArgs e) @@ -2090,8 +2089,11 @@ namespace Nikse.SubtitleEdit.Controls TryLoadIcon(_pictureBoxStopOver, "StopOver"); TryLoadIcon(_pictureBoxStopDown, "StopDown"); TryLoadIcon(_pictureBoxFullscreen, "Fullscreen"); + TryLoadBitmap(ref _bitmapFullscreen, "Fullscreen"); TryLoadIcon(_pictureBoxFullscreenOver, "FullscreenOver"); + TryLoadBitmap(ref _bitmapFullscreenOver, "FullscreenOver"); TryLoadIcon(_pictureBoxFullscreenDown, "FullscreenDown"); + TryLoadBitmap(ref _bitmapFullscreenDown, "FullscreenDown"); TryLoadIcon(_pictureBoxMute, "Mute"); TryLoadIcon(_pictureBoxMuteOver, "MuteOver"); TryLoadIcon(_pictureBoxMuteDown, "MuteDown"); @@ -2100,26 +2102,47 @@ namespace Nikse.SubtitleEdit.Controls TryLoadIcon(_pictureBoxVolumeBarBackground, "VolumeBarBackground"); TryLoadIcon(_pictureBoxVolumeBar, "VolumeBar"); - TryLoadBitmap(ref _bitmapFullscreen, "Fullscreen"); - TryLoadBitmap(ref _bitmapFullscreenDown, "FullscreenDown"); - TryLoadBitmap(ref _bitmapFullscreenOver, "FullscreenOver"); - TryLoadBitmap(ref _bitmapNoFullscreen, "NoFullscreen"); TryLoadBitmap(ref _bitmapNoFullscreenDown, "NoFullscreenDown"); TryLoadBitmap(ref _bitmapNoFullscreenOver, "NoFullscreenOver"); - var bg = (_pictureBoxBackground.Image as Bitmap); - _labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top); - _labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top); - _labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top); + if (_pictureBoxBackground.Image is Bitmap bg) + { + _labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top); + _labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top); + _labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top); + } - //TODO: Auto set fore color depending on bg color - // _labelVolume.ForeColor = Color.Gray; - // _labelTimeCode.ForeColor = Color.Gray; - // _labelVideoPlayerName.ForeColor = Color.Gray; + // Set ForeColor to either white or black depending on background color + if (_labelVolume.BackColor.R + _labelVolume.BackColor.G + _labelVolume.BackColor.B > 255 * 1.5) + { + _labelVolume.ForeColor = Color.Black; + } + else + { + _labelVolume.ForeColor = Color.White; + } + + if (_labelTimeCode.BackColor.R + _labelTimeCode.BackColor.G + _labelTimeCode.BackColor.B > 255 * 1.5) + { + _labelTimeCode.ForeColor = Color.Black; + } + else + { + _labelVolume.ForeColor = Color.White; + } + + if (_labelVideoPlayerName.BackColor.R + _labelVideoPlayerName.BackColor.G + _labelVideoPlayerName.BackColor.B > 255 * 1.5) + { + _labelVideoPlayerName.ForeColor = Color.Black; + } + else + { + _labelVideoPlayerName.ForeColor = Color.White; + } } - private void TryLoadBitmap(ref Bitmap bmp, string name) + private static void TryLoadBitmap(ref Bitmap bmp, string name) { var pb = new PictureBox(); TryLoadIcon(pb, name); @@ -2139,7 +2162,7 @@ namespace Nikse.SubtitleEdit.Controls theme = Configuration.Settings.General.ToolbarIconTheme; } - var themeFullPath = Path.Combine(Configuration.IconsDirectory, theme, "VideoPlayer", iconName + ".png"); + var themeFullPath = Path.Combine(Configuration.IconsDirectory, theme, "VideoPlayer", iconName + ".png"); if (File.Exists(themeFullPath)) { pb.Image = new Bitmap(themeFullPath);