Skip to content

Add theme support#118

Merged
Oliver-Quail merged 10 commits into
thoth-tech:mainfrom
nielsent478:add_theme_support
Jul 10, 2025
Merged

Add theme support#118
Oliver-Quail merged 10 commits into
thoth-tech:mainfrom
nielsent478:add_theme_support

Conversation

@nielsent478
Copy link
Copy Markdown
Contributor

Description

This update adds dynamic theming support to SplashKit Online by introducing a new applyTheme() function.

The function allows developers to override existing CSS variables at runtime using a JavaScript JSON object. It targets variables defined in /Browser_IDE/css/theming/colours.css and makes it easy to experiment with custom color schemes without editing the CSS file directly.

Required ./Javascript/themes.js inside the index.html
The function can also be tested in the browser console.

image

  • themes.js script in /Browser_IDE/Javascript
  • Global applyTheme
  • Updated <script> tag in index.html to include the theming logic
  • Tested locally in Chrome

@nielsent478 nielsent478 changed the base branch from Browser_IDE to main April 16, 2025 19:08
Copy link
Copy Markdown
Collaborator

@Oliver-Quail Oliver-Quail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Theiss,
Well documented code and has been well written.
I tested the code in firefox and it worked without error :)
Also I would consider just mentioning this request to Cameron as he would probably like to document this.
I approve this request :)

Comment thread Browser_IDE/Javascript/themes.js
@nielsent478
Copy link
Copy Markdown
Contributor Author

I've made the requested changes on themes.js.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2025

🐋 PR Preview!
The preview is no more!
Congrats if this was merged! 😄

@nielsent478
Copy link
Copy Markdown
Contributor Author

nielsent478 commented Apr 24, 2025

Description

I have updated the source themes.js code so it can be used in the index.html code with a selection of pre-defined themes. It adds an event listener for themeSelection so it can apply the theme that was selected.

This image shows an example theme selected (Space):
image

  • Screenshot
  • Tested Locally

Copy link
Copy Markdown
Contributor

@cameronhum cameronhum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Theiss,

Overall this is well done and is made with the future of the application in mind. The comments are well done and descriptive with that one tiny nitpick I mentioned. The applyTheme function does exactly as advertised in Chrome, Chromium based browsers, Edge and Firefox with no issues.

You did however add a new addition (theme selector) which I love the concept of and pushes this code into a user based use case, however it needs some touching up which I mentioned in earlier comments.

Once the changes are added I am happy to approve this.
I would also like to add the problems related to the themes are mainly relevant to the light theme. As such since this pull request main feature isn't the dropdown, if the light mode is removed rather than fixed and you are able to go back to default theme, that will also be acceptable for me to approve the review since the other themes all are functional and can be built upon in future pull requests.

Comment thread Browser_IDE/Javascript/themes.js
Comment thread Browser_IDE/Javascript/themes.js
@nielsent478
Copy link
Copy Markdown
Contributor Author

nielsent478 commented Apr 29, 2025

I've made the changes to add the option to select the default theme and made sure that all the relevant code comments were there. I added an additional comment explaining that elements from the colours.css file can be added to the themes.

@nielsent478 nielsent478 requested a review from cameronhum April 29, 2025 10:32
@nielsent478
Copy link
Copy Markdown
Contributor Author

I didn't change the GutterColour (main background column colour) but left it as a comment so future decision makers can add them if needed for each theme. Made sure that the 'yellow' editor strings (previously semi-concealed) were adjusted to a better colour for the light theme. Hopefully this should be sufficient enough for approval. Sincerely

Copy link
Copy Markdown
Contributor

@cameronhum cameronhum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Theiss,
Other than the small correction which stops it from running at the moment. I manually fixed it and tested it and am happy with it now!

I will approve it as soon as that is fixed. If possible message me on teams so I am able to do this for you ASAP

Comment thread Browser_IDE/Javascript/themes.js Outdated
if (!sel) return;
sel.add(new Option("default / none", "")); //Blank value = go back to default
//Add every theme as an option
Object.keys(themes).forEach(name => sel.add(new Option(name, name))); /Visible text, value
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'/Visible text, value'

this part causes an issue. needs '//'

Copy link
Copy Markdown
Contributor

@cameronhum cameronhum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pulled the new changes and you have addressed the syntax error and I can confirm everything works as intended. I am happy to approve it now good job the functionality looks great!

Copy link
Copy Markdown
Contributor

@WhyPenguins WhyPenguins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey all, just wanted to leave some thoughts 😃 The feature is really neat and I think looks good from a code perspective! I agree that the user facing part still needs some work though - either that or it could just be hidden for now.

A couple of the styles make the code/comments pretty hard to read:
image
image

For light mode I'd also expect something more like this I guess?
image
(just a very quick mockup based on https://github.com/nilshartmann/vscode-blue-light-theme/)

If you want to have a go at improving those feel free to, otherwise yeah might be best to just hide the selector for now until the styles are ready.

One other thing code wise, I think it'd be good to make the page's color-scheme also configurable (right now it's hard-coded in stylesheet.css -> body) - this'll be useful for making the scrollbars and such match in light mode 😄

@nielsent478
Copy link
Copy Markdown
Contributor Author

All done now. Apologies for pushing changes to this pull request late. I couldn't manage to add any additional features so I just hid the themes tab instead.

@Oliver-Quail Oliver-Quail merged commit 6a0014e into thoth-tech:main Jul 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants