Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/blocklywhitesprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions main/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ function setLogos(themeName) {
}
}

function setIconImage(htmlCollectionIcons, imageURL) {
for (const icon of htmlCollectionIcons) {
for (const image of icon.getElementsByTagName("image")) {
image.setAttribute("xlink:href", imageURL);
}
}
}

function setBinAndZoomIcons(themeName) {
const binIcon = document.getElementsByClassName("blocklyTrash");
const zoomIcons = document.getElementsByClassName("blocklyZoom");

if (themeName == "contrast") {
const iconsURL = "./images/blocklywhitesprites.png";
setIconImage(binIcon, iconsURL);
setIconImage(zoomIcons, iconsURL);
} else {
const iconsURL = "/blockly/media/sprites.png";
setIconImage(binIcon, iconsURL);
setIconImage(zoomIcons, iconsURL);
}
}

// Function to call when switching themes
function switchTheme(themeName) {
console.log(`Switching to theme: ${themeName}`);
Expand All @@ -129,6 +152,7 @@ function switchTheme(themeName) {
// }

setLogos(themeName);
setBinAndZoomIcons(themeName);

// Create custom theme for all themes
const themeConfig = createThemeConfig(themeName);
Expand Down
2 changes: 1 addition & 1 deletion style/blockly.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ textarea.blocklyCommentText.blocklyTextarea.blocklyText {
}

[data-theme="contrast"] .blocklyMainWorkspaceScrollbar .blocklyScrollbarHandle {
fill: rgba(255, 255, 255, 0.5) !important;
fill: rgba(255, 255, 255, 0.85) !important;
}

body[data-theme="contrast"] {
Expand Down