Fixes for header height and changing colors instantly

This commit is contained in:
Mayuran Visakan 2023-06-11 12:35:17 +01:00
parent 0e95fec16c
commit 3cd930c800
3 changed files with 18 additions and 10 deletions

12
main.js

File diff suppressed because one or more lines are too long

View file

@ -231,9 +231,13 @@ export function updateSettingStyles(settings: CodeblockCustomizerSettings) {
let themeColors = settings.colorThemes.find((theme) => {return theme['name'] == settings.SelectedTheme})['colors'];
let currentTheme = {name: 'current', colors: {}};
for (const key of Object.keys(stylesDict)) {
let currentValue = accessSetting(key,themeColors).toLowerCase();
if (accessSetting(key,defaultColors).toLowerCase() != currentValue) {
currentTheme['colors'][key] = currentValue;
let defaultValue = accessSetting(key,defaultColors).toLowerCase();
let themeValue = accessSetting(key,themeColors).toLowerCase();
let settingsValue = accessSetting(key,settings).toLowerCase();
if (defaultValue !== settingsValue) {
currentTheme['colors'][key] = settingsValue;
} else if (defaultValue !== themeValue) {
currentTheme['colors'][key] = themeValue;
}
}
let altHighlightStyling = settings.alternateColors.reduce((styling,altHighlight) => {return styling + `

View file

@ -6,7 +6,7 @@
--code-padding: 8px;
--header-padding: 0px;
--header-spacing: 15px;
--icon-size: 28px;
--language-icon-size: 28px;
}
/* Codeblock background colours */
@ -98,14 +98,14 @@ body .codeblock-customizer-header-container:not(:has( img.codeblock-customizer-i
.codeblock-customizer-header-container,
.codeblock-customizer-header-container-specific {
user-select: none;
height: var(--icon-size);
height: var(--language-icon-size);
padding-top: var(--header-padding);
border-top-left-radius: var(--border-radius);
border-top-right-radius: var(--border-radius);
background-color: var(--codeblock-customizer-header-background-color);
border-bottom: 2px groove var(--codeblock-customizer-header-line-color);
font-size: 14px;
margin-top: 16px; /* originalVal: none, set it to 16px, so the headergets the marginTop, which was removed from the first line of the codeblock */
margin-top: 16px; /* originalVal: none, set it to 16px, so the header gets the marginTop, which was removed from the first line of the codeblock */
display: flex !important;
overflow: visible;
}