feat: add site-specific styles for Sonarr, Chess.com, Gitea, and Anilist; implement dynamic style injection

This commit is contained in:
2026-01-23 18:09:19 +05:30
parent 925efe55cc
commit 730ebb0a0b
6 changed files with 219 additions and 7 deletions

View File

@@ -2,11 +2,56 @@ const domain = window.location.hostname;
chrome.storage.local.get([domain], (result) => {
if (result[domain] !== 'disabled') {
const link = document.createElement('link');
link.id = 'borland-theme-style';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = chrome.runtime.getURL('styles.css');
(document.head || document.documentElement).appendChild(link);
let siteMatched = false;
// 1. SONARR
const isSonarr = getComputedStyle(document.documentElement).getPropertyValue('--sonarrBlue').trim() !== "" ||
document.title.toLowerCase().includes('sonarr');
if (isSonarr) {
injectSiteStyle('sites/sonarr.local/styles.css');
siteMatched = true;
}
// 2. CHESS.COM
const isChess = domain.includes('chess.com') || !!document.querySelector('.board-layout-main');
if (isChess) {
injectSiteStyle('sites/chess.com/styles.css');
siteMatched = true;
}
const isAnilist = domain.includes('anilist.co');
if (isAnilist) {
injectSiteStyle('sites/anilist.co/styles.css');
siteMatched = true;
}
// 3. GITEA
const isGitea = !!document.querySelector('meta[content*="gitea"]') ||
!!document.querySelector('.ui.footer .item[href*="gitea.com"]') ||
domain.includes('gitea');
if (isGitea) {
console.log("Borland Theme: Gitea detected.");
injectSiteStyle('sites/gitea.local/styles.css');
siteMatched = true;
}
// --- GLOBAL FALLBACK ---
// Only inject global styles if NO specific site was matched
if (!siteMatched) {
console.log("Borland Theme: No specific site match. Applying global styles.");
injectSiteStyle('styles.css');
}
}
});
});
function injectSiteStyle(path) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = chrome.runtime.getURL(path);
(document.head || document.documentElement).appendChild(link);
}

View File

@@ -30,6 +30,15 @@
"<all_urls>"
]
},
{
"resources": [
"styles.css",
"sites/sonarr.local/styles.css"
],
"matches": [
"<all_urls>"
]
},
{
"resources": [
"sites/github.com/styles.css"
@@ -37,6 +46,18 @@
"matches": [
"https://github.com/*"
]
},
{
"resources": [
"styles.css",
"sites/sonarr.local/styles.css",
"sites/chess.com/styles.css",
"sites/gitea.local/styles.css",
"sites/anilist.co/styles.css"
],
"matches": [
"<all_urls>"
]
}
]
}

View File

@@ -0,0 +1,38 @@
.site-theme-dark {
--color-background: 0, 0, 164 !important;
--color-background-200: 0, 0, 164 !important;
--color-foreground: 17, 17, 192 !important;
--color-foreground-blue: 0, 0, 100 !important;
--color-text: 255, 255, 255 !important;
--color-foreground-grey-dark: 0, 0, 164;
--color-blue: 255, 255, 78 !important;
--color-text-lighter: 123, 193, 255 !important;
--color-text-light: 255, 255, 255 !important;
--color-background-100: 0, 0, 80 !important;
--color-foreground-grey: 12, 0, 129 !important;
}
.bar {
background: linear-gradient(270deg, #dce00e, #e4f67c) !important;
}
.user-page-unscoped.green {
--color-blue: 123, 193, 255 !important;
--color-blue-dim: 141, 185, 205 !important;
}
.nav-unscoped {
background-color: #000064 !important;
}
.create-btn {
color: #000064 !important;
}
.button.comment {
color: #000080 !important;
}
.wrap .footer {
background-color: #000064 !important;
}

View File

@@ -0,0 +1,4 @@
:root {
--theme-background-color: #0000A4 !important;
--cc-bg-color: linear-gradient(180deg, #CEFFAC 0%, #A8FF60 100%) !important;
}

View File

@@ -0,0 +1,35 @@
:root {
--color-body: #0000A4;
--color-primary: #FFFF4E;
--color-nav-bg: #000064;
--color-secondary-alpha-60: #0000A4;
--color-primary-light-4: #4141A9;
--color-primary-light-2: #888887;
--color-primary-dark-2: #abff37;
--color-primary-dark-4: #4fff23;
--color-box-header: #000080;
--color-secondary: #1111C0;
--color-box-body: #000064;
--color-active: #1111C0;
--color-menu: #000064;
--color-input-background: #0000A4;
--color-button: #0000A4;
--color-nav-hover-bg: #1111C0;
--color-secondary-nav-bg: #000080;
--color-card: #000080;
--color-secondary-light-1: #1111C0;
}
.tw-border-b-secondary {
background-color: #000064 !important;
}
.activity-heatmap-container {
background-color: #1111C0 !important;
padding: 2px 2px 2px 2px;
border-radius: 9px;
}
#navbar-logo img {
filter: hue-rotate(120deg);
}

View File

@@ -0,0 +1,69 @@
:root {
/* --- Core Surfaces & Text --- */
--pageBackground: #0000A4 !important;
/* Background */
--pageHeaderBackgroundColor: #000064 !important;
/* Cyan Header */
--sidebarBackgroundColor: #000064 !important;
--modalBackgroundColor: #0000A4 !important;
--cardBackgroundColor: #000080 !important;
/* Slightly darker blue */
--textColor: #FFFF4E !important;
/* Foreground Text */
--defaultColor: #FFFF4E !important;
--white: #FFFFFF !important;
--offWhite: #EEEEEE !important;
/* --- Brand & Accents --- */
--sonarrBlue: #96CBFE !important;
/* Borland Blue */
--primaryColor: #96CBFE !important;
--themeBlue: #96CBFE !important;
--selectedColor: #FFFFB6 !important;
/* Borland Yellow */
/* --- Status & Alerts (EGA/VGA Standard) --- */
--successColor: #679e3a !important;
/* Borland Green */
--successBackgroundColor: #639738 !important;
--dangerColor: #FF6C60 !important;
/* Borland Red */
--dangerBackgroundColor: #FF6C60 !important;
--warningColor: #FFFFB6 !important;
/* Borland Yellow */
--warningBackgroundColor: #FFFFB6 !important;
--infoColor: #C6C5FE !important;
/* Borland Cyan */
/* --- Navigation & Sidebar --- */
--sidebarColor: #FFFF4E !important;
/* Sidebar Text */
--sidebarActiveBackgroundColor: #0000A4 !important;
/* Highlight Grey */
--menuItemColor: #FFFF4E !important;
--menuItemHoverBackgroundColor: #4F4F4F !important;
/* --- Inputs & Interactive --- */
--inputBackgroundColor: #4F4F4F !important;
/* Grey Host background */
--inputBorderColor: #EEEEEE !important;
--inputFocusBorderColor: #FFFFB6 !important;
--borderColor: #FFFFB6 !important;
/* --- Buttons --- */
--defaultBackgroundColor: #4F4F4F !important;
--defaultButtonTextColor: #EEEEEE !important;
--primaryBackgroundColor: #96CBFE !important;
/* --- Calendar & Tables --- */
--calendarBackgroundColor: #0000A4 !important;
--calendarBorderColor: #1111C0 !important;
--tableRowHoverBackgroundColor: rgba(79, 79, 79, 0.5) !important;
/* --- Scrollbars --- */
--scrollbarBackgroundColor: #4F4F4F !important;
--scrollbarHoverBackgroundColor: #7C7C7C !important;
--toolbarBackgroundColor: #000064 !important;
}