From 730ebb0a0b9a90f5ea55fbe9bad139aa3993d97f Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Fri, 23 Jan 2026 18:09:19 +0530 Subject: [PATCH] feat: add site-specific styles for Sonarr, Chess.com, Gitea, and Anilist; implement dynamic style injection --- borlander/content.js | 59 ++++++++++++++++++--- borlander/manifest.json | 21 ++++++++ borlander/sites/anilist.co/styles.css | 38 ++++++++++++++ borlander/sites/chess.com/styles.css | 4 ++ borlander/sites/gitea.local/styles.css | 35 +++++++++++++ borlander/sites/sonarr.local/styles.css | 69 +++++++++++++++++++++++++ 6 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 borlander/sites/anilist.co/styles.css create mode 100644 borlander/sites/chess.com/styles.css create mode 100644 borlander/sites/gitea.local/styles.css create mode 100644 borlander/sites/sonarr.local/styles.css diff --git a/borlander/content.js b/borlander/content.js index 11fbc3e..e2bcdba 100644 --- a/borlander/content.js +++ b/borlander/content.js @@ -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'); + } } -}); \ No newline at end of file +}); + +function injectSiteStyle(path) { + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = chrome.runtime.getURL(path); + (document.head || document.documentElement).appendChild(link); +} \ No newline at end of file diff --git a/borlander/manifest.json b/borlander/manifest.json index 03659df..ed9c698 100644 --- a/borlander/manifest.json +++ b/borlander/manifest.json @@ -30,6 +30,15 @@ "" ] }, + { + "resources": [ + "styles.css", + "sites/sonarr.local/styles.css" + ], + "matches": [ + "" + ] + }, { "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": [ + "" + ] } ] } \ No newline at end of file diff --git a/borlander/sites/anilist.co/styles.css b/borlander/sites/anilist.co/styles.css new file mode 100644 index 0000000..fe1bea3 --- /dev/null +++ b/borlander/sites/anilist.co/styles.css @@ -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; +} \ No newline at end of file diff --git a/borlander/sites/chess.com/styles.css b/borlander/sites/chess.com/styles.css new file mode 100644 index 0000000..321105e --- /dev/null +++ b/borlander/sites/chess.com/styles.css @@ -0,0 +1,4 @@ +:root { + --theme-background-color: #0000A4 !important; + --cc-bg-color: linear-gradient(180deg, #CEFFAC 0%, #A8FF60 100%) !important; +} \ No newline at end of file diff --git a/borlander/sites/gitea.local/styles.css b/borlander/sites/gitea.local/styles.css new file mode 100644 index 0000000..283333b --- /dev/null +++ b/borlander/sites/gitea.local/styles.css @@ -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); +} \ No newline at end of file diff --git a/borlander/sites/sonarr.local/styles.css b/borlander/sites/sonarr.local/styles.css new file mode 100644 index 0000000..652879c --- /dev/null +++ b/borlander/sites/sonarr.local/styles.css @@ -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; +} \ No newline at end of file