Fix css autocolors.
This commit is contained in:
parent
bcdee7eb2b
commit
ba44eabe95
@ -89,8 +89,18 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
|
|
||||||
const styles = window.getComputedStyle(document.body)
|
const styles = window.getComputedStyle(document.body)
|
||||||
|
|
||||||
|
// Peertube has no CSS variable for the button color...
|
||||||
|
// Computing by hand.
|
||||||
|
// Searching for one of these button:
|
||||||
|
const button = document.querySelector('.publish-button') ?? document.querySelector('.peertube-button-link')
|
||||||
|
if (!button) {
|
||||||
|
logger.warn('[AutoColors] Cant find a button, aborting.')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const buttonStyles = window.getComputedStyle(button)
|
||||||
|
|
||||||
const autocolors: AutoColors = {
|
const autocolors: AutoColors = {
|
||||||
mainForeground: styles.getPropertyValue('--mainColor'),
|
mainForeground: styles.getPropertyValue('--mainForegroundColor'),
|
||||||
mainBackground: styles.getPropertyValue('--mainBackgroundColor'),
|
mainBackground: styles.getPropertyValue('--mainBackgroundColor'),
|
||||||
greyForeground: styles.getPropertyValue('--greyForegroundColor'),
|
greyForeground: styles.getPropertyValue('--greyForegroundColor'),
|
||||||
greyBackground: styles.getPropertyValue('--greyBackgroundColor'),
|
greyBackground: styles.getPropertyValue('--greyBackgroundColor'),
|
||||||
@ -98,8 +108,8 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
menuBackground: styles.getPropertyValue('--menuBackgroundColor'),
|
menuBackground: styles.getPropertyValue('--menuBackgroundColor'),
|
||||||
inputForeground: styles.getPropertyValue('--inputForegroundColor'),
|
inputForeground: styles.getPropertyValue('--inputForegroundColor'),
|
||||||
inputBackground: styles.getPropertyValue('--inputBackgroundColor'),
|
inputBackground: styles.getPropertyValue('--inputBackgroundColor'),
|
||||||
buttonForeground: styles.getPropertyValue('--mainColor'),
|
buttonForeground: buttonStyles.color,
|
||||||
buttonBackground: styles.getPropertyValue('--mainBackgroundColor'),
|
buttonBackground: styles.getPropertyValue('--mainColor'),
|
||||||
link: styles.getPropertyValue('--mainForegroundColor'),
|
link: styles.getPropertyValue('--mainForegroundColor'),
|
||||||
linkHover: styles.getPropertyValue('--mainForegroundColor')
|
linkHover: styles.getPropertyValue('--mainForegroundColor')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user