client: restore dynamic scrollbar alpha, continue removing old scrollbar styling

This commit is contained in:
jean-emmanuel 2025-09-19 08:53:52 +02:00
parent c5243126ee
commit b93f3e57ac
7 changed files with 43 additions and 123 deletions

View file

@ -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)
}
}

View file

@ -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(()=>{

View file

@ -4,6 +4,7 @@ import Container from '../common/container.mjs'
import widgetManager from '../../managers/widgets.mjs'
import parser from '../../parser.mjs'
import {enableTraversingGestures, disableTraversingGestures} from '../../events/drag.mjs'
import {setScrollbarColor} from '../../ui/utils.mjs'
import Script from '../scripts/script.mjs'
import * as resize from '../../events/resize'
import {DOM} from '../../globals.mjs'
@ -365,6 +366,13 @@ class Panel extends Container() {
}
setCssVariables() {
super.setCssVariables()
setScrollbarColor(this.container)
}
setTraversing(update) {
var traversing = this.getProp('traversing')