fix(whatsapp-web): rewrite theme with variables (#1798)

Co-authored-by: uncenter <[email protected]>
This commit is contained in:
WalkQuackBackanduncenter authored and GitHub committed 2025-08-07 10:03:54 -04:00
1 parent 148842cfc6
commit d9260e2236
1 file changed
+201 -578
+201 -578
View File
@@ -14,18 +14,70 @@
@var select darkFlavor "Dark Flavor" ["latte:Latte", "frappe:Frappé", "macchiato:Macchiato", "mocha:Mocha*"]
@var select accentColor "Accent" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve*", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"]
@var checkbox lighterMessages "Lighter incoming messages" 0
@var checkbox lighterMessages "Elevated incoming messages" 0
==/UserStyle== */
@-moz-document domain("web.whatsapp.com") {
body {
/* Note: Some variables appear to be applied on :root,
but without using :has there doesn't seem to be a good
way to target the root whenever a certain theme is applied.
*/
:root:has(> :not(.dark)),
:root .color-refresh,
.color-refresh,
/* Layer under mount */
.x1bapj5e.x1bapj5e,
.x1bapj5e.x1bapj5e:root {
#catppuccin(@lightFlavor);
}
body.dark {
:root:has(> .dark),
.dark.color-refresh,
.color-refresh.dark,
/* Layer under mount */
.x1vmw6bp.x1vmw6bp,
.x1vmw6bp.x1vmw6bp:root {
#catppuccin(@darkFlavor);
}
/* "System default" theme */
.xnw4er1.xnw4er1, .xnw4er1.xnw4er1:root {
#catppuccin(@lightFlavor);
}
@media (prefers-color-scheme: dark) {
.xnw4er1.xnw4er1, .xnw4er1.xnw4er1:root {
#catppuccin(@darkFlavor);
}
}
#initialLoad(@styles) {
#RGB(splashscreen-startup-background, @styles[@crust]) !important;
#RGB(splashscreen-startup-icon, @styles[@surface0]) !important;
#RGB(splashscreen-primary-title, @styles[@text]) !important;
#RGB(splashscreen-progress-primary, @styles[@@accentColor]) !important;
#RGB(splashscreen-progress-background, @styles[@surface1]) !important;
#RGB(splashscreen-secondary-lighter, @styles[@overlay2]) !important;
#RGB(startup-icon, @styles[@surface1]) !important;
#RGB(startup-background, @styles[@crust]) !important;
#RGB(progress-background, @styles[@overlay0]) !important;
}
// Inital loading screen (Avoid FOUC)
[style^="--splashscreen-startup-background: #F7F5F3;"] {
#initialLoad(@catppuccin[@@lightFlavor]);
}
[style^="--splashscreen-startup-background: #0A1014;"] {
#initialLoad(@catppuccin[@@darkFlavor]);
}
#catppuccin(@flavor) {
@rosewater: @catppuccin[@@flavor][@rosewater];
@flamingo: @catppuccin[@@flavor][@flamingo];
@@ -55,6 +107,8 @@
@crust: @catppuccin[@@flavor][@crust];
@accent: @catppuccin[@@flavor][@@accentColor];
@accentContent: if(@flavor = latte, @base, @crust);
color-scheme: if(@flavor = latte, light, dark);
::selection {
@@ -68,612 +122,181 @@
}
}
.landing-wrapper-before {
background-color: @accent !important;
}
@emphasize: 10%;
@deemphasize: if(@flavor = latte, 15%, 30%);
/* STATUS PAGE */
--status-background: @base !important;
.bfsx6evv {
background-color: @mantle !important;
}
@scrim: 30%;
@pressed: 20%;
--modal-backdrop-solid: @base !important;
#WDS(accent, @accent);
#WDS(accent-deemphasized, fade(@accent, @deemphasize));
#WDS(accent-emphasized, lighten(@accent, @emphasize));
/* join group pop up */
--modal-background: @base !important;
#WDS(secondary-negative, @red);
#WDS(secondary-negative-deemphasized, fade(@red, @deemphasize));
#WDS(secondary-negative-emphasized, @red);
/* startup progress */
--progress-primary: @accent !important;
--progress-background: @surface1 !important;
--startup-background: @base !important;
--startup-background-rgb: #rgbify(@base)[];
/* home page, no chat selected */
--intro-background: @base !important;
--intro-border: @accent !important;
/* general background */
--app-background: @base !important;
#WDS(secondary-positive, @green);
#WDS(secondary-positive-deemphasized, fade(@green, @deemphasize));
/* CHAT LIST */
/* nav bar background */
--navbar-background: @mantle !important;
/* filters container background */
--filters-container-background: @base !important;
/* filters item background */
--filters-item-background: @surface0 !important;
/* filters item color */
--filters-item-color: @subtext0 !important;
/* filters item background hover */
--filters-item-background-hover: @surface1 !important;
/* filters item active background */
--filters-item-active-background: fade(@accent, 30%) !important;
/* filters item active color */
--filters-item-active-color: @accent !important;
/* chat list background */
--background-default: @base !important;
/* chat list header */
--panel-header-background: @mantle !important;
/* icons */
--panel-header-icon: @text !important;
/* other warnings (notifications) */
--butterbar-default-background: @mantle !important;
--butterbar-notification-icon: @sky !important;
/* loading messages warning */
--butterbar-green-nux-background: @mantle !important;
/* update available warning */
--butterbar-update-background: @mantle !important;
--butterbar-update-icon: @accent !important;
/* chat list search bar */
--search-container-background: @base !important;
--search-input-container-background: @base !important;
--search-input-background: @surface0 !important;
--search-input-container-background-active: @mantle !important;
--icon-search-back: @accent !important;
/* archive icon */
--icon-bright-highlight: @accent !important;
/* archived unread marker */
--unread-marker-background: @accent !important;
--unread-timestamp: @accent !important;
/* archived chats header */
--archived-chat-persistent-header-background: @crust !important;
/* unread voice message */
--ptt-green: @green !important;
/* read voice message */
--ptt-blue: @blue !important;
/* pinned chat icon */
--icon-pinned: @accent !important;
/* last message in selected chat */
--secondary-stronger: @subtext1 !important;
/* background for active and hover chats in chat list */
--background-default-active: @surface1 !important;
--background-default-hover: @surface0 !important;
/* unread chats filter */
--icon-high-emphasis: @green !important;
.p7idzaix {
color: @crust !important;
}
/* voice message playing */
--ptt-ooc-background: @mantle !important;
#WDS(secondary-warning, @yellow);
#WDS(secondary-warning-deemphasized, fade(@yellow, @deemphasize));
/* CONVERSATION */
/* chat background */
--conversation-panel-background: @mantle !important;
/* MESSAGES */
/* background for incoming and outgoing messages */
& when (@lighterMessages = 1) {
--incoming-background: @surface1 !important;
--incoming-background-deeper: @surface2 !important;
/* arrow icon in messages */
--incoming-background-rgb: #rgbify(@surface1)[];
}
& when (@lighterMessages = 0) {
--incoming-background: @base !important;
--incoming-background-deeper: @surface0 !important;
/* arrow icon in messages */
--incoming-background-rgb: #rgbify(@base)[];
}
--outgoing-background: @surface0 !important;
/* read double tick */
--icon-ack: @blue !important;
/* received double tick */
--bubble-meta-icon: @subtext0 !important;
/* message timestamp */
--bubble-meta: @text !important;
--message-primary: @text !important;
/* POLL */
/* creation */
--poll-modal-background-color: @base !important;
--poll-modal-footer-background-color: @surface0 !important;
/* votes */
--poll-bar-fill-receiver: @green !important;
--poll-bar-fill-sender: @green !important;
--checkbox-mark: @crust !important;
#WDS(content-default, @text);
#WDS(content-deemphasized, @overlay2);
#WDS(content-disabled, fade(@text, 50%));
/* audio duration */
--audio-progress-metadata: @subtext0 !important;
/* system messages (unread or day messages in chats) */
--system-message-text: @text !important;
--system-message-background: @crust !important;
/* unread system message background */
--unread-background: @crust !important;
--unread-bar-background: @surface1 !important;
/* meta data for documents */
--document-meta: @subtext1 !important;
/* mentions, links and link previews */
--mention-at-symbol: @sapphire !important;
--link: @sapphire !important;
--link-preview: @text !important;
--link-preview-lighter: @subtext1 !important;
--link-preview-light: @subtext0 !important;
--outgoing-background-rgb: #rgbify(@surface0)[];
/* QUOTED MESSAGES */
/* quoted messages */
--quoted-message-text: @text !important;
/* background for quoted incoming and outgoing messages */
--outgoing-background-deeper: @surface1 !important;
#WDS(content-on-accent, @accentContent);
#WDS(content-action-default, @accent);
#WDS(content-action-emphasized, lighten(@accent, @emphasize));
#WDS(content-external-link, @blue);
#WDS(content-inverse, @crust);
#WDS(content-read, @blue);
/* SEARCH IN CHAT HIGHLIGHT */
--highlight: @teal !important;
#WDS(background-wash-inset, @crust);
#WDS(background-wash-plain, @crust);
#WDS(background-elevated-wash-plain, @crust);
#WDS(background-elevated-wash-inset, @crust);
#WDS(background-dimmer, fade(#000, @scrim));
/* quote colors */
.bg-color-1 {
background-color: @green !important;
}
.color-1 {
color: @green !important;
}
.bg-color-2 {
background-color: @blue !important;
}
.color-2 {
color: @blue !important;
}
.bg-color-3 {
background-color: @pink !important;
}
.color-3 {
color: @pink !important;
}
.bg-color-4 {
background-color: @sapphire !important;
}
.color-4 {
color: @sapphire !important;
}
.bg-color-5 {
background-color: @peach !important;
}
.color-5 {
color: @peach !important;
}
.bg-color-6 {
background-color: @sky !important;
}
.color-6 {
color: @sky !important;
}
.bg-color-7 {
background-color: @yellow !important;
}
.color-7 {
color: @yellow !important;
}
.bg-color-8 {
background-color: @teal !important;
}
.color-8 {
color: @teal !important;
}
.bg-color-9 {
background-color: @lavender !important;
}
.color-9 {
color: @lavender !important;
}
.bg-color-10 {
background-color: @red !important;
}
.color-10 {
color: @red !important;
}
.bg-color-11 {
background-color: @mauve !important;
}
.color-11 {
color: @mauve !important;
}
.bg-color-12 {
background-color: @flamingo !important;
}
.color-12 {
color: @flamingo !important;
}
.bg-color-13 {
background-color: @rosewater !important;
}
.color-13 {
color: @rosewater !important;
}
.bg-color-14 {
background-color: @pink !important;
}
.color-14 {
color: @pink !important;
}
.bg-color-15 {
background-color: @maroon !important;
}
.color-15 {
color: @maroon !important;
}
.bg-color-16 {
background-color: @teal !important;
}
.color-16 {
color: @teal !important;
}
/* general text */
--primary: @text !important;
--primary-strong: @text !important;
--primary-stronger: @text !important;
--primary-strongest: @text !important;
--secondary: @subtext0 !important;
--secondary-strongest-rgb: #rgbify(@text)[];
--inline-code-text: @blue !important;
/* chat list typing message */
--typing: @green !important;
/* background for video player and image viewer */
--media-viewer-background: @mantle !important;
/* not loaded media */
--media-gallery-thumb-background: @crust !important;
#WDS(surface-default, @mantle);
#WDS(surface-emphasized, @base);
#WDS(surface-elevated-default, @base);
#WDS(surface-elevated-emphasized, mix(@text, @base, @emphasize));
#WDS(surface-highlight, fade(@text, @pressed));
#WDS(surface-inverse, @text);
#WDS(surface-pressed, fade(@text, @pressed));
/* Group info/Contact info */
--photopicker-overlay-background: fade(@mantle, 20%) !important;
--photopicker-overlay-background-rgb: #rgbify(@base)[];
--media-viewer-background-rgb: #rgbify(@base)[];
--drawer-background-deep: @crust !important;
/* group info read more */
--input-button-more: @sapphire !important;
/* Group info thumbnails border */
--chat-info-drawer-thumb-background: @surface2 !important;
/* Group admin badge background */
--chat-marker-background: @mantle !important;
--chat-marker-border: @mantle !important;
/* Group admin badge foreground */
--chat-marker: @subtext0 !important;
/* Media gallery */
--drawer-gallery-background: @crust !important;
/* mute toggle */
--switch-button-checked-color: @accent !important;
--switch-track-checked-color: @surface2 !important;
--switch-track-color: @surface2 !important;
--switch-button-color: @overlay1 !important;
#WDS(lines-divider, fade(@text, 10%));
#WDS(lines-outline-default, @overlay0);
#WDS(lines-outline-deemphasized, fade(@text, @deemphasize));
/* danger, block, exit and report buttons */
--danger: @red !important;
#WDS(persistent-activity-indicator, fade(@green, 90%));
#WDS(persistent-always-black, #000);
#WDS(persistent-always-white, #fff);
#WDS(persistent-always-branded, @accent);
/* group added by someone not in contacts */
--button-plain-background: @surface0 !important;
--button-plain-background-hover: @surface1 !important;
#WDS(
systems-bubble-surface-incoming,
if(@lighterMessages = 1, @surface1, @base),
);
/* EMOJI AND STICKERS */
--panel-input-background: @surface0 !important;
--sticker-button-background: @surface1 !important;
--active-tab-marker: @accent !important;
#WDS(systems-bubble-surface-outgoing, mix(@accent, @base, @deemphasize));
#WDS(systems-bubble-content-deemphasized, fade(@text, 50%));
/* REACTIONS */
--reactions-panel-background-color: @surface0 !important;
--reactions-tray-background: @surface0 !important;
--reactions-details-background: @surface0 !important;
--svg-gray-button: @surface0 !important;
#WDS(systems-bubble-surface-overlay, @mantle);
#WDS(systems-bubble-surface-system, @mantle);
/* Forward message popup */
--panel-background-colored-deeper: @crust !important;
--modal-backdrop: fade(@mantle, 20%) !important;
#WDS(systems-bubble-surface-e2e, mix(@yellow, @mantle, 5%));
#WDS(systems-bubble-content-e2e, @yellow);
/* Forward media caption */
--forward-caption-preview-background: @mantle !important;
--forward-caption-preview-content: @crust !important;
#WDS(systems-bubble-surface-business, mix(@teal, @mantle, 5%));
/* MEDIA EDITOR */
/* background for media editor */
--panel-background-deeper: @mantle !important;
/* message box for media editor */
--media-editor-image-caption-input-background: @surface0 !important;
/* selected picture in media editor */
--media-editor-thumb-border-active: @accent !important;
/* send button in media editor */
--button-round-background: @accent !important;
#WDS(systems-chat-surface-composer, @base);
#WDS(systems-chat-background-wallpaper, @crust);
#WDS(systems-chat-foreground-wallpaper, @mantle);
#WDS(systems-chat-surface-tray, @base);
#WDS(systems-status-seen, fade(@text, 50%));
/* COMPOSE BAR */
/* type a message bar and background */
--compose-input-background: @surface0 !important;
--compose-input-border: @surface1 !important;
--compose-panel-background: @mantle !important;
--rich-text-panel-background: @mantle !important;
/* select messages fixes */
--panel-background: @mantle !important;
--panel-background-rgb: #rgbify(@mantle)[];
--checkbox-background: @accent !important;
/* quoted message in compose */
--popup-panel-background: @surface0 !important;
/* use Surface 0 for contrast, other colors don't pass AAA */
/* mention list item background */
--compose-panel-background-hover: @surface1 !important;
/* compose bar icons */
--icon: @accent !important;
/* ATTACH ICONS */
/* poll icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(6)
> button
> span
> svg
> circle {
fill: @green !important;
}
/* image icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(1)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(2) {
fill: @pink !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(1)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(1) {
fill: @pink !important;
filter: brightness(85%) !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(1)
> button
> span
> svg
> g:nth-child(1)
> g
> rect {
fill: @pink !important;
filter: brightness(70%) !important;
}
/* sticker icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(2)
> button
> span
> svg
> g
> circle {
fill: @blue !important;
filter: brightness(85%) !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(2)
> button
> span
> svg
> g
> path:nth-child(2) {
fill: @blue !important;
}
/* camera icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(3)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(1) {
fill: @red !important;
filter: brightness(85%) !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(3)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(2) {
fill: @red !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(3)
> button
> span
> svg
> g:nth-child(1)
> g
> rect {
fill: @red !important;
filter: brightness(85%) !important;
}
/* document icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(4)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(1) {
fill: @mauve !important;
filter: brightness(85%) !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(4)
> button
> span
> svg
> g:nth-child(1)
> g
> path:nth-child(2) {
fill: @mauve !important;
}
/* contact icon */
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(5)
> button
> span
> svg
> g:nth-child(1)
> g
> g
> path:nth-child(1) {
fill: @sky !important;
filter: brightness(85%) !important;
}
div._1OT67
> div
> span
> div
> div
> ul
> li:nth-child(5)
> button
> span
> svg
> g:nth-child(1)
> g
> g
> path:nth-child(2) {
fill: @sky !important;
}
/* VOICE MESSAGE SENDING */
--ptt-draft-button-send: @accent !important;
--ptt-draft-waveform-background: @base !important;
--ptt-draft-button-stop: @red !important;
--ptt-draft-button-stop-hover: @maroon !important;
#WDS(components-platform-gesture-bar, fade(@crust, 50%));
#WDS(components-platform-status-bar, fade(@crust, 80%));
#WDS(components-surface-nav-bar, @base);
/* GENERAL OPTIONS */
/* dropdown menus */
--dropdown-background: @surface0 !important;
--dropdown-background-hover: @surface1 !important;
#WDS(app-wash, @surface0);
/* OTHER SECTIONS */
/* profile background */
--drawer-background: @base !important;
/* communities, new chat, other panes */
--panel-background-colored: @mantle !important;
--drawer-section-background: @base !important;
/* new chat icons */
--round-icon-background: @green !important;
--inverse: @text !important;
/* title and icon for drawers */
--drawer-header-title: @text !important;
/* buttons such as create community */
--button-primary-background: @accent !important;
--button-primary-background-hover: fade(@accent, 20%) !important;
/* keyboard shortcuts background */
--panel-background-lighter: @mantle !important;
/* active input in modals and drawers */
--input-border-active: @accent !important;
#WDS(white, @crust);
#RGB(white, @crust);
/* Start page drawing */
#app
> div
> div
> div._2Ts6i._2xAQV
> div
> div
> div.WM0_u
> span
> svg
> path:nth-child(1) {
fill: @surface2 !important;
}
#RGB(attachment-type-stickers-color, @green);
#RGB(attachment-type-polls-color, @yellow);
#RGB(attachment-type-contacts-color, @sky);
#RGB(attachment-type-camera-color, @pink);
#RGB(attachment-type-photos-color, @blue);
#RGB(attachment-type-documents-color, @mauve);
#RGB(attachment-type-audio-color, @peach);
/* \/ Note: Seems to be overwritten by a generated
CSS variable, so has no effect :( */
#RGB(attachment-type-event-color, @pink);
/* Status unread dot */
#df9d3429-f0ef-48b5-b5eb-f9d27b2deba6 > path:nth-child(2) {
#RGB(toast-background, @surface1);
#RGB(toast-text, @text);
#RGB(picker-background, @surface1);
#RGB(butterbar-blue-nux-background, @sky);
#RGB(butterbar-blue-nux-icon-background, darken(@sky, 30%));
#RGB(blue-light, @blue);
#RGB(gray-500, @overlay2);
#RGB(focus-animation, mix(@accent, @base, 40%));
#RGB(focus-animation-deeper, mix(@accent, @base, 30%));
#RGB(startup-icon, @surface1);
#RGB(startup-background, @crust);
#RGB(progress-background, @surface0);
/* "About AI messages" icon */
.st0 {
fill: @accent !important;
stroke: @surface0;
}
#side
> div._3gYev
/* TODO: Meta AI/other bot colours */
input[type="time"]::-webkit-datetime-edit-hour-field:focus,
input[type="time"]::-webkit-datetime-edit-minute-field:focus,
input[type="time"]::-webkit-datetime-edit-second-field:focus,
input[type="time"]::-webkit-datetime-edit-ampm-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus,
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus {
background-color: @accent;
color: @accentContent;
}
[data-icon="wa-wordmark-refreshed"] path {
fill: if(
@flavor = latte,
var(--WDS-persistent-always-branded),
currentcolor
);
}
/* Toasts */
#wa-popovers-bucket
+ span
> div
> div
> button
> div._3xdht._1ZD3q
> span
> svg
> path {
fill: @accent !important;
button:nth-of-type(1):not(:has(> [data-icon="x-alt"])) {
color: var(--WDS-accent-emphasized);
}
/* Date picker */
#RGB(date-picker-text-color, @text);
.react-calendar__tile:disabled {
color: @subtext0;
}
.react-calendar__month-view__days__day--neighboringMonth {
color: @overlay2;
}
}
}
#WDS(@id, @color) {
--WDS-@{id}: @color;
--WDS-@{id}-RGB: #rgbify(@color)[];
--WDS-@{id}-rgb: #rgbify(@color)[];
}
#RGB(@id, @color) {
--@{id}: @color;
--@{id}-rgb: #rgbify(@color)[];
}
// Commas are added to fit WhatsApp's variable schema.
#rgbify(@color) {
@rgb: red(@color) green(@color) blue(@color);
@rgb: red(@color), green(@color), blue(@color);
}
/* deno-fmt-ignore */