-
-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update functions.js fix YT dark theme #2253
Conversation
almost there, but |
yes, but we need ytd-searchbox-text-color. Wait a minute, I remember this conversation happening already? aaah #2143 its another one of those yt- to ytd- renamed color variables
looks like simple rename will suffice will suffice
yes, the " [dark]" rules override inside "#ytd-masthead [dark]"
because nobody bothered writing code doing live updates :) Ill do it some time later eventually as the way it "works" now is gross, might make users think its broken like I thought.
dont know how useful that will be for other functionality
I think I finally have working Theme switching and dark shortcut working, will update this pull in a sec. It does involve manipulating cookie after all
the way I rewrote it now extension picks up what default is based on cookie at the time of switching themes.
I was considering this, but I dont think extension can read youtube.com cookie without at least one tab being open on youtube.com |
hi! :) @raszpl
And this should be html[it-theme] : youtube/js&css/extension/www.youtube.com/styles.css Lines 2064 to 2100 in da7935a
(and, i forgot, are you sure about the " yes! shortcuts need reload. idk why. somehow it was easier to let them run for once when set (confusing)
yay (that will leave a reference to it in shortcuts.js, which might be repurposed) yes, the (youtube's-)dark shortcut code, was rather testing. Was made not to stick before to avoid cookies: (https://github.com/code-charity/youtube/blob/4f18256ab1b7fda9320084824d69e2a039a6b804/content-scripts/website-context/youtube-features/shortcuts.js#L614C1-L622C3). Not afraid of the cookie either f6=, if this shortcut shall stick. (i should just have reviewed your PR more since issues with it happened years ago.) (the shortcut could store another cookie setByImprovedTubeShortcut=dark priorToThat=device so if the shortcut is pressed ever again it can go back where it was, if not changed inbetween) (While now, without cookie we set [dark] everytime, which might helps a few users who remove all cookies, but otherwise isnt required) Our themes: default can be called none or off And we can still remove/replace the "Youtube's dark theme" button (to either replace it with this screenshot: ) - Or, if we finish your cookie code to also make the shortcut (or more one day), then we can make it a dropdown "YouTube's Theme Setting": Device setting | Light | Dark ( - Not required to be a stored feature. Reading F6 cookie to indicate the current and changing it only once Web accessible files can run even without currently being on youtube.com). (Next to adding/removing dark attribute as GUI feedback (so niceer than youtube's which will reload) do you still want to inject all theme's CSS with JS? most CSS variable appear exactly 6 times (some currently have irregular counts in styles.css:) 12 --yt-swatch-textbox-bg:
12 --yt-swatch-text:
12 --yt-swatch-primary:
12 --yt-swatch-primary-darker:
12 --yt-swatch-logo-override:
12 --yt-swatch-input-text:
12 --yt-swatch-important-text:
12 --yt-swatch-icon-color:
12 --yt-spec-icon-inactive:
11 --yt-spec-general-background-c:
11 --yt-spec-general-background-b:
11 --yt-spec-general-background-a:
8 --yt-spec-text-primary:
7 --yt-spec-text-secondary:
5 --yt-lightsource-section4-color:
5 --yt-lightsource-section3-color:
5 --yt-lightsource-section2-color:
5 --yt-lightsource-secondary-title-color:
5 --yt-lightsource-primary-title-color: --ytd-watch-split-pane-sidebar-background-color:
--ytd-watch-card-secondary-text-color:
--ytd-watch-card-album-header-background:
--ytd-video-publish-date-color:
--ytd-video-game-watch-card-logo-color:
--ytd-vat-notice-text:
--ytd-transcript-toolbar-text:
--ytd-transcript-toolbar-background-color:
--ytd-transcript-cue-hover-background-color:
--ytd-toggle-color:
--ytd-survey-button-color:
--ytd-sponsorships-background-color-focus:
--ytd-simple-badge-color:
--ytd-shopping-product-info:
--ytd-searchbox-legacy-button-icon-color:
--ytd-searchbox-legacy-button-hover-color:
--ytd-searchbox-legacy-button-hover-border-color:
--ytd-searchbox-legacy-button-focus-color:
--ytd-searchbox-legacy-button-color:
--ytd-searchbox-legacy-button-border-color:
--ytd-searchbox-legacy-border-shadow-color:
--ytd-searchbox-legacy-border-color:
--ytd-searchbox-border-color:
--ytd-searchbox-background:
--ytd-owner-badge-color:
--ytd-offer-background-color:
--ytd-moderation-panel-hover:
--ytd-moderation-panel-comment-text:
--ytd-moderation-panel-comment-metadata-text:
--ytd-moderation-panel-background:
--ytd-moderation-icon-hover-color:
--ytd-moderation-icon-color:
--ytd-comment-text-color:
--ytd-comment-metadata-text-color:
--ytd-collection-badge-color:
--ytd-badge-disabled-color:
--ytd-badge-background:
--ytd-backstage-video-link-background-color:
--ytd-backstage-metadata-text-color:
--ytd-backstage-image-alert-color:
--ytd-backstage-creationbox-text-color:
--ytd-backstage-creationbox-input-text-color:
--ytd-backstage-creationbox-inactive-color:
--ytd-backstage-creationbox-disabled-button-text-color:
--ytd-backstage-creationbox-disabled-button-color:
--ytd-backstage-creationbox-background-color:
--ytd-backstage-creationbox-background-color-focus:
--ytd-backstage-cancel-color:
--ytd-backstage-cancel-background-color:
--ytd-backstage-attachment-icon-hover-color:
--ytd-ad-badge-text-color:
--yt-transcript-background:
--yt-thumbnail-placeholder-color:
--yt-tertiary-text-color:
--yt-swatch-header-primary:
--yt-subscribe-button-text-color:
--yt-std-surface-400:
--yt-std-surface-300:
--yt-std-surface-200:
--yt-std-body-300:
--yt-std-body-200:
--yt-std-body-100:
--yt-spec-wordmark-text:
--yt-spec-verified-badge-background:
--yt-spec-touch-response:
--yt-spec-themed-green:
--yt-spec-themed-blue:
--yt-spec-text-primary-inverse:
--yt-spec-text-disabled:
--yt-spec-suggested-action:
--yt-spec-selected-nav-text:
--yt-spec-raised-background:
--yt-spec-menu-background:
--yt-spec-inverted-background:
--yt-spec-inactive-text-button-focus-outline:
--yt-spec-icon-disabled:
--yt-spec-icon-active-other:
--yt-spec-filled-button-text:
--yt-spec-filled-button-focus-outline:
--yt-spec-error-background:
--yt-spec-call-to-action:
--yt-spec-call-to-action-inverse:
--yt-spec-call-to-action-button-focus-outline:
--yt-spec-button-chip-background-hover:
--yt-spec-brand-text-button-focus-outline:
--yt-spec-brand-subscribe-button-background:
--yt-spec-brand-link-text:
--yt-spec-brand-icon-inactive:
--yt-spec-brand-icon-active:
--yt-spec-brand-button-background:
--yt-spec-brand-background-solid:
--yt-spec-brand-background-secondary:
--yt-spec-brand-background-primary:
--yt-spec-base-background:
--yt-spec-badge-chip-background:
--yt-spec-10-percent-layer:
--yt-simple-menu-header-background:
--yt-sidebar-background:
--yt-secondary-text-color:
--yt-searchbox-text-color:
--yt-primary-text-color:
--yt-primary-disabled-button-text-color:
--yt-primary-color:
--yt-playlist-title-text:
--yt-playlist-message-text:
--yt-playlist-message-text-hover:
--yt-playlist-background-item:
--yt-playlist-background-header:
--yt-placeholder-text:
--yt-placeholder-text-color:
--yt-paper-button-ink-color:
--yt-metadata-color:
--yt-menu-hover-backgound-color:
--yt-menu-focus-background-color:
--yt-material-searchbox-text-color:
--yt-material-searchbox-inset:
--yt-material-searchbox-inactive:
--yt-material-searchbox-inactive-shadow:
--yt-material-searchbox-active:
--yt-material-searchbox-active-shadow:
--yt-main-app-background:
--yt-main-app-background-tmp:
--yt-live-chat-tertiary-text-color:
--yt-live-chat-secondary-text-color:
--yt-live-chat-primary-text-color:
--yt-live-chat-picker-button-color:
--yt-live-chat-disabled-icon-button-color:
--yt-live-chat-action-panel-background-color:
--yt-live-chat-action-panel-background-color-transparent:
--yt-item-section-header-color:
--yt-icon-hover-color:
--yt-icon-disabled-color:
--yt-icon-color:
--yt-icon-active-color:
--yt-hovered-text-color:
--yt-guide-entry-hover-background-color:
--yt-guide-background:
--yt-formatted-string-emoji-size:
--yt-formatted-string-deemphasize-color:
--yt-featured-channel-title-text-color:
--yt-expand-color:
--yt-endpoint-color:
--yt-disabled-text-color:
--yt-dialog-background:
--yt-copyright-text:
--yt-commentbox-border-inactive:
--yt-commentbox-border-active:
--yt-chat-bubble-self-border-color:
--yt-chat-bubble-self-background-color:
--yt-chat-bubble-other-border-color:
--yt-chat-bubble-other-background-color:
--yt-channel-owner:
--yt-channel-header-background:
--yt-button-text-color:
--yt-button-payment-text-color:
--yt-brand-color:
--yt-border-color:
--yt-blue-suggestive:
--yt-app-background:
--yt-alert-background:
--paper-toggle-button-unchecked-bar-color:
--paper-menu-color:
--paper-menu-background-color:
--paper-listbox-color:
--paper-listbox-background-color:
--paper-dialog-background-color: |
yay! a PR with 7+ files changed
meant your |
is this a time to remember that f6 can have 5 different values and you wrote code for it? 😅
(none = device theme preference) |
Thats all. automagically picks up Dark cookie on load if there was no theme set shortcutDarkTheme just sends the signal up the chain to switch dark/light theme light theme doesnt really exist, its just a placeholder for a signal. It does live theme change ([dark] deletion), saves F6 light cookie and deletes itself dark is normal permanent theme |
do you remember what they all meant? I remember discovering it, but cant find the post now |
so we have to respect/carry on device preference none and grid/list view. you started with that here: youtube/js&css/web-accessible/www.youtube.com/themes.js Lines 115 to 129 in b80b77f
and when changing it, through shortcut, can remember it, with two more variables (in storage or cookie)
|
yeah I found #2105 |
Now find some bugs in there for me to fix X-) |
...And there is another shortcut/button already: (
just to be complete https://developer.chrome.com/docs/extensions/reference/api/cookies ) |
YT shows Ambient/Cinematics option only with Dark cookie present, switching to Light removes dark cookie youtube/js&css/extension/www.youtube.com/styles.css Lines 635 to 641 in 64f89e5
it should all be converted to CSS with no manual style manipulation anyway :) |
Just in case you like another little @raszpl puzzle around satus.js & colors youtube/menu/styles/themes.css Lines 222 to 223 in 8f6ac27
|
I also asked for same thing :] but didnt think about how to implement it almost forgot, we need locale for youtubesLight like the one for youtubesDark [YouTube's dark] |
No description provided.