From 925efe55ccad44ee87770a745ae5cb6ad3be0306 Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Thu, 22 Jan 2026 09:37:33 +0530 Subject: [PATCH] feat: add popup functionality and theme styles for Borlander extension --- borlander/content.js | 12 +++++ borlander/manifest.json | 28 +++++++++++- borlander/popup.html | 31 +++++++++++++ borlander/popup.js | 22 +++++++++ borlander/sites/github.com/styles.css | 13 ++++++ borlander/styles.css | 65 +++++++++++++++++++++------ readme.md | 6 +++ 7 files changed, 163 insertions(+), 14 deletions(-) create mode 100644 borlander/popup.html create mode 100644 borlander/popup.js create mode 100644 borlander/sites/github.com/styles.css create mode 100644 readme.md diff --git a/borlander/content.js b/borlander/content.js index e69de29..11fbc3e 100644 --- a/borlander/content.js +++ b/borlander/content.js @@ -0,0 +1,12 @@ +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); + } +}); \ No newline at end of file diff --git a/borlander/manifest.json b/borlander/manifest.json index 4f1a206..03659df 100644 --- a/borlander/manifest.json +++ b/borlander/manifest.json @@ -3,13 +3,39 @@ "name": "Borlander", "version": "1.0", "description": "Applies the classic Borland blue and yellow theme to all websites.", + "permissions": [ + "storage", + "tabs" + ], "content_scripts": [ { "matches": [ "" ], - "css": [ + "exclude_matches": [ + "*://monkeytype.com/*", + "*://*.monkeytype.com/*" + ], + "js": [ + "content.js" + ] + } + ], + "web_accessible_resources": [ + { + "resources": [ "styles.css" + ], + "matches": [ + "" + ] + }, + { + "resources": [ + "sites/github.com/styles.css" + ], + "matches": [ + "https://github.com/*" ] } ] diff --git a/borlander/popup.html b/borlander/popup.html new file mode 100644 index 0000000..bc395a6 --- /dev/null +++ b/borlander/popup.html @@ -0,0 +1,31 @@ + + + + + + + + +

Domain

+ + + + + \ No newline at end of file diff --git a/borlander/popup.js b/borlander/popup.js new file mode 100644 index 0000000..97fe43b --- /dev/null +++ b/borlander/popup.js @@ -0,0 +1,22 @@ +chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + const url = new URL(tabs[0].url); + const domain = url.hostname; + document.getElementById('site-name').textContent = domain; + + const btn = document.getElementById('toggle-btn'); + + chrome.storage.local.get([domain], (result) => { + const isDisabled = result[domain] === 'disabled'; + btn.textContent = isDisabled ? "Enable on this site" : "Disable on this site"; + + btn.onclick = () => { + if (isDisabled) { + chrome.storage.local.remove(domain); + } else { + chrome.storage.local.set({ [domain]: 'disabled' }); + } + chrome.tabs.reload(tabs[0].id); + window.close(); + }; + }); +}); \ No newline at end of file diff --git a/borlander/sites/github.com/styles.css b/borlander/sites/github.com/styles.css new file mode 100644 index 0000000..f0db530 --- /dev/null +++ b/borlander/sites/github.com/styles.css @@ -0,0 +1,13 @@ +:root { + --contribution-default-bgColor-0: #4F4F4F !important; + --contribution-default-bgColor-1: #FFFFB6 !important; + --contribution-default-bgColor-2: #FFFFCC !important; + --contribution-default-bgColor-3: #FFFF4E !important; + --contribution-default-bgColor-4: #ffea00 !important; + + --contribution-default-borderColor-0: #4F4F4F !important; +} + +.ContributionCalendar-label { + color: #FFFF4E !important; +} \ No newline at end of file diff --git a/borlander/styles.css b/borlander/styles.css index 2e854b7..bd5a9ad 100644 --- a/borlander/styles.css +++ b/borlander/styles.css @@ -1,9 +1,37 @@ -/* 1. Global Reset (The Borland Look) */ +:root { + --bgColor-default: #0000A4 !important; + --bgColor-muted: #000080 !important; + --bgColor-inset: #000060 !important; + + --fgColor-default: #FFFF4E !important; + --fgColor-muted: #EEEEEE !important; + --fgColor-accent: #B5DCFF !important; + + --button-default-bgColor-rest: #4F4F4F !important; + --button-default-fgColor-rest: #FFFF4E !important; + --control-bgColor-rest: #4F4F4F !important; + + --color-ansi-blue: #96CBFE !important; + --color-ansi-cyan: #C6C5FE !important; + --color-ansi-green: #A8FF60 !important; + --color-ansi-red: #FF6C60 !important; +} + +video, +.html5-video-player, +.html5-video-container { + background-color: transparent !important; +} + + html, body, div, span, +nav, p, +footer, +textarea, section, article { background-color: #0000A4 !important; @@ -14,20 +42,40 @@ article { video, .html5-video-player, .html5-video-container, -.ytp-gradient-bottom, -.ytp-gradient-top, .ytp-chrome-bottom, canvas { background-color: transparent !important; } -/* prevent the "Blue Box" */ div[class*="player"], div[class*="video"], div[class*="overlay"] { background-color: transparent !important; } +input, +textarea, +select, +button, +input[type="text"], +input[type="search"], +input[type="email"], +#search-input, +.gsfi { + background-color: #4F4F4F !important; + color: #FFFF4E !important; + border: 2px solid #EEEEEE !important; + border-radius: 0px !important; + appearance: none !important; + -webkit-appearance: none !important; + box-shadow: none !important; +} + +::placeholder { + color: #7C7C7C !important; + opacity: 1; +} + a, a * { color: #B5DCFF !important; @@ -41,13 +89,4 @@ h4, h5, h6 { color: #FFFFFF !important; -} - -input, -textarea, -button, -select { - background-color: #4F4F4F !important; - color: #FFFF4E !important; - border: 1px solid #EEEEEE !important; } \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..ee429a7 --- /dev/null +++ b/readme.md @@ -0,0 +1,6 @@ +# Borlander + + +#### Monkeytype theme + +[Monkeytype](https://monkeytype.com?customTheme=eyJjIjpbIiMwMDAwYTQiLCIjZmZmZjRlIiwiI2RjOGE3OCIsIiNhY2IwYmUiLCIjNzA3MDcwIiwiI2ZmZmY0ZSIsIiNkMjBmMzkiLCIjZTY0NTUzIiwiI2QyMGYzOSIsIiNlNjQ1NTMiXSwiaSI6IiIsInMiOiJjb3ZlciIsImYiOlswLDEsMSwxXX0=) \ No newline at end of file