diff --git a/content.js b/content.js index 6e1311c..4f42f84 100644 --- a/content.js +++ b/content.js @@ -4,13 +4,18 @@ chrome.storage.local.get(['canvas_theme'], result=> { let theme = JSON.parse(result.canvas_theme) document.querySelector(':root').style.setProperty('--canvas-style-bgc', theme.backgroundcolor) document.querySelector(':root').style.setProperty('--canvas-style-tc', theme.textcolor) + document.querySelector(':root').style.setProperty('--canvas-style-bc', theme.bordercolor) console.log("[CANVAS THEMEINATOR] Theme Loaded: " + theme.name) } else { chrome.storage.local.set({ 'canvas_theme' : JSON.stringify({ name: "Dark", backgroundcolor: "rgb(46, 46, 46)", - textcolor: "white" + textcolor: "white", + bordercolor: "white", })}) + document.querySelector(':root').style.setProperty('--canvas-style-bgc', "rgb(46, 46, 46)") + document.querySelector(':root').style.setProperty('--canvas-style-tc', "white") + document.querySelector(':root').style.setProperty('--canvas-style-bc', "white") console.log("[CANVAS THEMEINATOR] Theme Loaded: Dark") } }) @@ -18,3 +23,11 @@ chrome.storage.local.get(['canvasborderradius'], result=> { document.querySelector(':root').style.setProperty('--canvas-border-radius', (result.canvasborderradius) ? (result.canvasborderradius) : ('15px')) }) +chrome.storage.local.get(['boxshadow'], result=>{ + if (result.boxshadow===undefined) { + chrome.storage.local.set({ 'boxshadow' : true }) + document.querySelector(':root').style.setProperty('--canvas-box-shadow', '0px 2px 10px 0px white') + } else { + document.querySelector(':root').style.setProperty('--canvas-box-shadow', (result.boxshadow) ? '0px 2px 10px 0px white' : 'none') + } +}) diff --git a/html/index.html b/html/index.html index 5fa6a4e..972d08b 100644 --- a/html/index.html +++ b/html/index.html @@ -40,6 +40,8 @@

Click a button to set the Canvas Theme



+ +

@@ -48,7 +50,9 @@

Click a button to set the Canvas Theme

Current Theme: Dark


- +
+ +

Reload the page for changes to appear


diff --git a/html/script.js b/html/script.js index c574f8b..57258d0 100644 --- a/html/script.js +++ b/html/script.js @@ -1,12 +1,13 @@ -function createSetThemeListener(elemid, name, color, textcolor) { +function createSetThemeListener(elemid, name, color, textcolor, bordercolor) { let elem = document.getElementById(elemid) elem.addEventListener('click', () => { document.getElementById("custom-form").style.display = 'none' chrome.storage.local.set({ 'canvas_theme' : JSON.stringify({ name: name, backgroundcolor: color, - textcolor: textcolor + textcolor: textcolor, + bordercolor: bordercolor, })}) document.getElementById('theme').innerText = name document.getElementById('theme').style.color = textcolor @@ -15,15 +16,15 @@ function createSetThemeListener(elemid, name, color, textcolor) { } { - createSetThemeListener('dark', 'Dark', 'rgb(46, 46, 46)', 'white') - createSetThemeListener('amoled', 'AMOLED Dark', 'rgb(0, 0, 0)', 'white') - createSetThemeListener('purple', 'Purple', 'rgb(103, 7, 192)', 'white') - createSetThemeListener('blue', 'Blue', 'rgb(62, 91, 255)', 'white') - createSetThemeListener('green', 'Green', 'rgb(0, 197, 105)', 'white') - createSetThemeListener('orange', 'Orange', 'rgb(236, 143, 22)', 'white') - createSetThemeListener('darkpurple', 'Dark Purple', 'rgb(59, 0, 114)', 'white') - createSetThemeListener('darkblue', 'Dark Blue', 'rgb(0, 19, 124)', 'white') - createSetThemeListener('light', 'Light', 'white', 'black') + createSetThemeListener('dark', 'Dark', 'rgb(46, 46, 46)', 'white', 'white') + createSetThemeListener('amoled', 'AMOLED Dark', 'rgb(0, 0, 0)', 'white', 'white') + createSetThemeListener('purple', 'Purple', 'rgb(103, 7, 192)', 'white', 'white') + createSetThemeListener('blue', 'Blue', 'rgb(62, 91, 255)', 'white', 'white') + createSetThemeListener('green', 'Green', 'rgb(0, 197, 105)', 'white', 'white') + createSetThemeListener('orange', 'Orange', 'rgb(236, 143, 22)', 'white', 'white') + createSetThemeListener('darkpurple', 'Dark Purple', 'rgb(59, 0, 114)', 'white', 'white') + createSetThemeListener('darkblue', 'Dark Blue', 'rgb(0, 19, 124)', 'white', 'white') + createSetThemeListener('light', 'Light', 'white', 'black', 'black') document.getElementById("custom-form").style.display = 'none' document.getElementById('custom').addEventListener('click', ()=>{ @@ -39,12 +40,14 @@ function createSetThemeListener(elemid, name, color, textcolor) { let formData = new FormData(document.getElementById("custom-form")) let name = formData.get("name-input") let textcolor = formData.get("tc-input") + let bordercolor = formData.get("boc-input") let color = formData.get("bc-input") document.getElementById("custom-form").style.display = 'none' chrome.storage.local.set({ 'canvas_theme' : JSON.stringify({ name: name, backgroundcolor: color, - textcolor: textcolor + textcolor: textcolor, + bordercolor: bordercolor, })}) document.getElementById('theme').innerText = name document.getElementById('theme').style.color = textcolor @@ -56,12 +59,15 @@ function createSetThemeListener(elemid, name, color, textcolor) { document.getElementById('rounded').addEventListener('change', () => { chrome.storage.local.set({ 'canvasborderradius': (document.getElementById('rounded').checked) ? '15px' : '0' }) }) + document.getElementById('boxshadow').addEventListener('change', ()=>{ + chrome.storage.local.set({ 'boxshadow' : document.getElementById('boxshadow').checked}) + }) } { chrome.storage.local.get(['canvas_theme'], result=>{ - let theme = JSON.parse(result.canvas_theme) - if (theme) { + if (result.canvas_theme) { + let theme = JSON.parse(result.canvas_theme) document.getElementById('theme').innerText = theme.name document.getElementById('theme').style.color = theme.textcolor document.getElementById('theme').style.backgroundColor = theme.backgroundcolor @@ -75,4 +81,7 @@ function createSetThemeListener(elemid, name, color, textcolor) { if (result.canvasborderradius == '15px') document.getElementById("rounded").checked = true if (result.canvasborderradius === undefined) document.getElementById("rounded").checked = true }) + chrome.storage.local.get(['boxshadow'], result=>{ + if (result.boxshadow == true || result.boxshadow === undefined) document.getElementById("boxshadow").checked = true + }) } \ No newline at end of file diff --git a/style.css b/style.css index 07c55ee..5398c14 100644 --- a/style.css +++ b/style.css @@ -2,12 +2,14 @@ --canvas-style-bgc: rgb(46, 46, 46); --canvas-border-radius: 15px; --canvas-style-tc: white; + --cavnas-style-bc: white; + --canvas-box-shadow: 0px 2px 10px 0px white; } :not(.Grouping-styles__overlay, .ic-DashboardCard__header_hero, .ic-DashboardCard__header_image) { background-color: var(--canvas-style-bgc) !important; color: var(--canvas-style-tc) !important; - border-color: var(--canvas-style-tc) !important; + border-color: var(--canvas-style-bc) !important; background-image: none !important; border-radius: var(--canvas-border-radius) !important; } @@ -38,7 +40,7 @@ svg { .Grouping-styles__overlay { border-style: solid !important; - box-shadow: -1px 1px 11px 1px white !important; + box-shadow: var(--canvas-box-shadow) !important; border-radius: var(--canvas-border-radius) !important; } @@ -52,8 +54,8 @@ svg { ol.Grouping-styles__items { margin-left: 15px !important; - border: 2px solid var(--canvas-style-tc) !important; - box-shadow: 0px 2px 10px 0px white !important; + border: 2px solid var(--canvas-style-bc) !important; + box-shadow: var(--canvas-box-shadow) !important; } .NotificationBadge-styles__activityIndicator.NotificationBadge-styles__hasBadge {