Skip to content

Commit 418e01d

Browse files
committed
Abstracted scheme var in modals.stylize() ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/bravegpt]
1 parent 83d6098 commit 418e01d

1 file changed

Lines changed: 23 additions & 26 deletions

File tree

chatgpt/bravegpt/bravegpt.user.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.10.16
151+
// @version 2025.10.16.1
152152
// @license MIT
153153
// @icon https://assets.bravegpt.com/images/icons/app/icon48.png?v=e8ca7c2
154154
// @icon64 https://assets.bravegpt.com/images/icons/app/icon64.png?v=e8ca7c2
@@ -2067,7 +2067,6 @@
20672067
document.removeEventListener(eventType, modals.handlers.drag[eventType]))
20682068
modals.draggingModal = null
20692069
}
2070-
20712070
}
20722071
},
20732072

@@ -2092,8 +2091,7 @@
20922091
// Hack BG
20932092
dom.addRisingParticles(modal)
20942093
setTimeout(() => { // dim bg
2095-
modal.parentNode.style.backgroundColor = `rgba(67,70,72,${
2096-
env.ui.app.scheme == 'dark' ? 0.62 : 0.33 })`
2094+
modal.parentNode.style.backgroundColor = `rgba(67,70,72,${ env.ui.app.scheme == 'dark' ? 0.62 : 0.33 })`
20972095
modal.parentNode.classList.add('animated')
20982096
}, 100) // delay for transition fx
20992097
},
@@ -2500,6 +2498,7 @@
25002498
},
25012499

25022500
stylize() {
2501+
const { scheme: appScheme } = env.ui.app
25032502
if (!this.styles?.isConnected) document.head.append(this.styles ||= dom.create.style())
25042503
this.styles.textContent = (
25052504

@@ -2521,20 +2520,20 @@
25212520
${ env.browser.isPhone ? 'padding: 25px 31px !important' : '' }
25222521
}
25232522
.chatgpt-modal p { margin: 14px 0 -20px 4px ; font-size: 18px } /* pos/size modal msg */
2524-
.chatgpt-modal a { color: #${ env.ui.app.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }
2523+
.chatgpt-modal a { color: #${ appScheme == 'dark' ? '00cfff' : '1e9ebb' } !important }
25252524
.modal-buttons {
25262525
margin: 38px 0 1px ${ env.browser.isMobile ? 0 : -7 }px !important ; width: 100% }
25272526
.chatgpt-modal button { /* this.alert() buttons */
25282527
min-width: 123px ; padding: ${ env.browser.isMobile ? '5px' : '4px 8px' } !important ;
25292528
cursor: pointer ; border-radius: 0 !important ; height: 39px ;
2530-
border: 1px solid ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }!important }
2529+
border: 1px solid ${ appScheme == 'dark' ? 'white' : 'black' }!important }
25312530
.primary-modal-btn { background: black !important ; color: white !important }
25322531
.chatgpt-modal button:hover {
2533-
${ env.ui.app.scheme == 'light' ? // reduce intensity of light scheme hover glow
2532+
${ appScheme == 'light' ? // reduce intensity of light scheme hover glow
25342533
'--btn-shadow: 2px 1px 43px #00cfff70 ;' : '' }
25352534
color: inherit !important ; background-color: inherit !important /* remove color hacks */
25362535
}
2537-
${ env.ui.app.scheme == 'dark' ? // darkmode chatgpt.alert() styles
2536+
${ appScheme == 'dark' ? // darkmode chatgpt.alert() styles
25382537
`.chatgpt-modal > div, .chatgpt-modal button:not(.primary-modal-btn) {
25392538
color: white !important }
25402539
.primary-modal-btn { background: #00cfff !important ; color: black !important }
@@ -2546,9 +2545,8 @@
25462545
cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px
25472546
}
25482547
[class*=modal-close-btn] path {${
2549-
env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white'
2550-
: 'stroke: #9f9f9f ; fill: #9f9f9f' }}
2551-
${ env.ui.app.scheme == 'dark' ? // invert dark mode hover paths
2548+
appScheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: #9f9f9f ; fill: #9f9f9f' }}
2549+
${ appScheme == 'dark' ? // invert dark mode hover paths
25522550
'[class*=modal-close-btn]:hover path { stroke: black ; fill: black }' : '' }
25532551
[class*=modal-close-btn]:hover { background-color: #f2f2f2 } /* hover underlay */
25542552
[class*=modal-close-btn] svg { margin: 11.5px } /* center SVG for hover underlay */
@@ -2571,10 +2569,9 @@
25712569
position: absolute ; /* to be click-draggable */
25722570
opacity: 0 ; /* to fade-in */
25732571
background-image: linear-gradient(180deg, ${
2574-
env.ui.app.scheme == 'dark' ? '#99a8a6 -200px, black 200px'
2575-
: '#b6ebff -296px, white 171px' }) ;
2576-
border: 1px solid ${ env.ui.app.scheme == 'dark' ? 'white' : '#b5b5b5' } !important ;
2577-
color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' };
2572+
appScheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) ;
2573+
border: 1px solid ${ appScheme == 'dark' ? 'white' : '#b5b5b5' } !important ;
2574+
color: ${ appScheme == 'dark' ? 'white' : 'black' };
25782575
transform: translateX(-3px) translateY(7px) ; /* offset to move-in from */
25792576
transition: var(--fg-transition) ; /* fade-in + move-in */
25802577
-webkit-transition: var(--fg-transition) ; -moz-transition: var(--fg-transition) ;
@@ -2593,7 +2590,7 @@
25932590
font-family: var(--brand-font) ;
25942591
min-width: ${ env.browser.isPortrait ? 288 : 758 }px ; max-width: 75vw ; margin: 12px 23px ;
25952592
word-wrap: break-word ; border-radius: 15px ;
2596-
${ env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: black ; fill: black' };
2593+
${ appScheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: black ; fill: black' };
25972594
--shadow: 0 30px 60px rgba(0,0,0,0.12) ;
25982595
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) }
25992596
#${app.slug}-settings-title {
@@ -2606,13 +2603,13 @@
26062603
list-style: none ; padding: 0 ; margin: 0 ; /* hide bullets, override Brave ul margins */
26072604
width: ${ env.browser.isPortrait ? 100 : 50 }% } /* set width based on column cnt */
26082605
${ env.browser.isPhone ? '' : `#${app.slug}-settings ul:first-of-type { /* color desktop middle sep */
2609-
border-right: 1px dotted ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }}`}
2606+
border-right: 1px dotted ${ appScheme == 'dark' ? 'white' : 'black' }}`}
26102607
#${app.slug}-settings li {
2611-
color: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2612-
fill: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2613-
stroke: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2608+
color: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2609+
fill: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2610+
stroke: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
26142611
height: 37px ; padding: 7px 10px ; font-size: 14.5px ;
2615-
border-bottom: 1px dotted ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }; /* add separators */
2612+
border-bottom: 1px dotted ${ appScheme == 'dark' ? 'white' : 'black' }; /* add separators */
26162613
border-radius: 3px ; /* slightly round highlight strip */
26172614
${ config.fgAnimationsDisabled || env.browser.isMobile ? '' :
26182615
`transition: var(--settings-li-transition) ;
@@ -2621,9 +2618,9 @@
26212618
-o-transition: var(--settings-li-transition) ;
26222619
-ms-transition: var(--settings-li-transition)` }}
26232620
#${app.slug}-settings li.active {
2624-
color: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }; /* for text */
2625-
fill: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }; /* for icons */
2626-
stroke: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }} /* for icons */
2621+
color: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }; /* for text */
2622+
fill: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }; /* for icons */
2623+
stroke: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }} /* for icons */
26272624
#${app.slug}-settings li label { padding-right: 20px } /* right-pad labels so toggles don't hug */
26282625
#${app.slug}-settings li:last-of-type { border-bottom: none } /* remove last bottom-border /*
26292626
#${app.slug}-settings li, #${app.slug}-settings li label { cursor: pointer } /* add finger on hover */
@@ -2649,7 +2646,7 @@
26492646
${ config.fgAnimationsDisabled ? '' // spin cycle arrows icon when scheme is Auto
26502647
: `#scheme-settings-entry svg[class*=arrowsCyclic],'
26512648
+ '.chatgpt-notif svg[class*=arrowsCyclic] { animation: rotate 5s linear infinite }`}
2652-
#about-settings-entry span { color: ${ env.ui.app.scheme == 'dark' ? '#28ee28' : 'green' }}
2649+
#about-settings-entry span { color: ${ appScheme == 'dark' ? '#28ee28' : 'green' }}
26532650
#about-settings-entry > span { /* outer About status span */
26542651
width: ${ env.browser.isPortrait ? '15vw' : '95px' }; height: 20px ; overflow: hidden ;
26552652
${ config.fgAnimationsDisabled ? '' : // fade edges
@@ -2661,7 +2658,7 @@
26612658
text-wrap: nowrap ; ${
26622659
config.fgAnimationsDisabled ? '' : 'animation: ticker linear 75s infinite' }}
26632660
@keyframes ticker { 0% { transform: translateX(100%) } 100% { transform: translateX(-2000%) }}
2664-
.about-em { color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'green' } !important }`
2661+
.about-em { color: ${ appScheme == 'dark' ? 'white' : 'green' } !important }`
26652662
)
26662663
},
26672664

0 commit comments

Comments
 (0)