client: restore dynamic scrollbar alpha, continue removing old scrollbar styling
This commit is contained in:
parent
c5243126ee
commit
b93f3e57ac
7 changed files with 43 additions and 123 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import UiWidget from './ui-widget.mjs'
|
||||
import {setScrollbarColor} from './utils.mjs'
|
||||
|
||||
class UiWorkspace extends UiWidget {
|
||||
|
||||
|
|
@ -6,6 +7,8 @@ class UiWorkspace extends UiWidget {
|
|||
|
||||
super(options)
|
||||
|
||||
setScrollbarColor(this.container)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import chroma from 'chroma-js'
|
||||
import fastdom from 'fastdom'
|
||||
import {DOM} from '../globals.mjs'
|
||||
|
||||
|
|
@ -10,6 +11,36 @@ export function iconify(string){
|
|||
return String(string).replace(/\^[^\s]{2,}/g,(x)=>{return icon(x.substring(1))})
|
||||
}
|
||||
|
||||
export function setScrollbarColor(container) {
|
||||
|
||||
fastdom.measure(()=>{
|
||||
|
||||
var computedStyle = window.getComputedStyle(container),
|
||||
alpha = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar')),
|
||||
alphaOn = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar-on')),
|
||||
color = computedStyle.getPropertyValue('--color-fill').trim()
|
||||
|
||||
if (color === 'transparent') {
|
||||
// prevent chroma-js error
|
||||
// irrelevant case, but still...
|
||||
color = 'rgb(0, 0, 0)'
|
||||
alpha = 0
|
||||
alphaOn = 0
|
||||
}
|
||||
|
||||
if (color) {
|
||||
fastdom.mutate(()=>{
|
||||
try {
|
||||
container.style.setProperty('--color-scrollbar', chroma(color).alpha(alpha).css())
|
||||
container.style.setProperty('--color-scrollbar-on', chroma(color).alpha(alphaOn).css())
|
||||
} catch(e) {}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export function updateMobileThemeColor(root) {
|
||||
|
||||
fastdom.measure(()=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue