@@ -14,6 +14,7 @@ import WatchVideoPlaylist from '../../components/WatchVideoPlaylist/WatchVideoPl
1414import WatchVideoRecommendations from '../../components/WatchVideoRecommendations/WatchVideoRecommendations.vue'
1515import FtAgeRestricted from '../../components/FtAgeRestricted/FtAgeRestricted.vue'
1616import packageDetails from '../../../../package.json'
17+ import { calculateColorLuminance } from '../../helpers/colors'
1718import {
1819 buildVTTFileLocally ,
1920 copyToClipboard ,
@@ -60,16 +61,6 @@ const UNAVAILABLE_VIDEO_THUMBNAILS = {
6061 light : 'https://www.youtube.com/img/desktop/unavailable/unavailable_video.png' ,
6162 dark : 'https://www.youtube.com/img/desktop/unavailable/unavailable_video_dark_theme.png'
6263}
63- const LIGHT_BASE_THEMES = new Set ( [
64- 'light' ,
65- 'pastelPink' ,
66- 'catppuccinLatte' ,
67- 'solarizedLight' ,
68- 'gruvboxLight' ,
69- 'everforestLightHard' ,
70- 'everforestLightMedium' ,
71- 'everforestLightLow'
72- ] )
7364
7465export default defineComponent ( {
7566 name : 'Watch' ,
@@ -206,9 +197,6 @@ export default defineComponent({
206197 backendFallback : function ( ) {
207198 return this . $store . getters . getBackendFallback
208199 } ,
209- baseTheme : function ( ) {
210- return this . $store . getters . getBaseTheme
211- } ,
212200 currentInvidiousInstanceUrl : function ( ) {
213201 return this . $store . getters . getCurrentInvidiousInstanceUrl
214202 } ,
@@ -1094,9 +1082,8 @@ export default defineComponent({
10941082 } ,
10951083
10961084 getUnavailableVideoThumbnail : function ( ) {
1097- const baseTheme = this . baseTheme || 'system'
1098- const isLightTheme = LIGHT_BASE_THEMES . has ( baseTheme ) ||
1099- ( baseTheme === 'system' && ! window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches )
1085+ const backgroundColor = window . getComputedStyle ( document . body ) . backgroundColor
1086+ const isLightTheme = calculateColorLuminance ( backgroundColor ) === '#000000'
11001087
11011088 return isLightTheme
11021089 ? UNAVAILABLE_VIDEO_THUMBNAILS . light
0 commit comments