colineckert / obsidian-things

An Obsidian theme inspired by the beautifully-designed app, Things.
MIT License
721 stars 62 forks source link

FR: Add Alternative Checkboxes toggle in Style Settings #169

Open damiankorcz opened 4 days ago

damiankorcz commented 4 days ago

This request comes as part of the initiative I've started for Obsidian October 2024. Additional information and progress on this project can be found here: https://github.com/damiankorcz/Alternative-Checkboxes-Reference-Set

The current goal is to make it easier for users to implement their own CSS Snippets with Alternative Checkboxes, regardless of the theme they use. At the moment, any theme that doesn't present an option to disable their Alternative Checkboxes implementation, requires the snippet to overwrite the existing theme's code. This can become complicated and hard to maintain as currently 44 themes implement Alternative Checkboxes. Ideally, if all themes have the option to disable their implementation, the snippets can be simpler, and work universally across all themes.

If this is something you are interested in implementing, it would require the following code to be added to your theme:

body.enable-alternative-checkboxes {

/* Encapsulate all code relevant to Altenative Checkboxes here */

}

Add a toggle in the Style Settings code:

-
    id: enable-alternative-checkboxes
    title: Enable Alternative Checkboxes
    description: Disable this if you are using your own implementation via a CSS Snippet.
    default: true
    type: class-toggle
-

Since your theme already implements the feature, the code above enables it by default, in order to not change the existing functionality for users.

When the theme implementation is disabled, all additional checkboxes should be styled the same as the default - [x] checked checkbox; removing any changes to color, icons, fonts, backgrounds, etc.

If you need any help implementing this, let me know! I can also look into making a Pull Request if you would prefer.