Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Color Setup #4

Open
QuantumSoundings opened this issue Apr 17, 2024 · 4 comments
Open

Improved Color Setup #4

QuantumSoundings opened this issue Apr 17, 2024 · 4 comments
Assignees

Comments

@QuantumSoundings
Copy link

Hi saw your youtube showcase of your setup and loved the sidebar.

I made some changes that make it easier to change and assign colors. Consider adopting it if you like it too! With this setup you only need to change the color value of the prefix variable and the color will update. Instead of needing to modify the css blocks themselves to update the color variables. I only added coloring for the 10's digits but you could expand it to all 99 prefixes.
Colored Sidebar Items (Modified).txt

@CyanVoxel CyanVoxel self-assigned this Apr 17, 2024
@QuantumSoundings
Copy link
Author

I added a bit more to the snippet. I changed the class blocks to have more specific selectors for the child elements. This helps keep the indentation guidelines only applying to the child elements. I also changed the datapath selectors to be *=, so that the folders don't have to be in the root. Here is what it looks like in practice.
Colored Sidebar Items (Modified+).txt

Normal View:
image

We can place higher numbered folders inside lower numbered folders and still see the color change correctly.
image

The one thing I couldn't work out was lower number folders inside higher numbered ones. I think this would require a plugin to go in and modify things dynamically. Not sure it can be done with just css.
image

@CyanVoxel
Copy link
Owner

I love the separation you've done with the variables in your first comment! I'm already working on implementing them in that style as we speak. As for the specific selectors for the child elements, I 100% see the desire to have this, but personally I prefer to have the style only affect the top-level folders. Maybe I could offer two different versions of the snippet, one with this and one without? And yeah, it would be nice if there was a way to let the child folders always overwrite the parents - maybe there's something but it'll take some more tinkering to find it. I'll keep the issue open in case a solution is found.

I'm also working on a way to more easily customize the colors per prefix using the Style Settings plugin (https://github.com/mgmeyers/obsidian-style-settings), but unfortunately I can't find a way to change the data-path attributes via CSS variables/properties, so those will still have to stay hardcoded for now. I'll be including presets for both my single incrementing prefixes (up to 10), as well as your x10 prefixes (up to 90/99).

@QuantumSoundings
Copy link
Author

I'm glad you liked the changes! As for top level folders, its entirely up to you. Everything is a fine balance of solving your own use cases and wanting to support other people's usecases when you're just doing the project for fun! :)

An alternative to a separate version of the file could be just a blurb in the readme saying: "To enable folder highlighting at any folder level find and replace all 'data-path^=' with 'data-path*='. Doing this may have unintended side effects."

Style Settings might also be great for configuration. I don't think it would solve the problem with nesting lower numbers inside higher numbers, but color management would be much easier!

@CyanVoxel
Copy link
Owner

An alternative to a separate version of the file could be just a blurb in the readme saying: "To enable folder highlighting at any folder level find and replace all 'data-path^=' with 'data-path*='. Doing this may have unintended side effects."

Works for me! I'll also include a blurb in the README, maybe with an example image as well.

Style Settings might also be great for configuration. I don't think it would solve the problem with nesting lower numbers inside higher numbers, but color management would be much easier!

I wish there was a way to build a toggle for the nesting, but sadly there doesn't seem to be an easy method (thanks, data-paths...). At least it'll make the colors a bit more configurable!

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

No branches or pull requests

2 participants