ecustic / obsidian-file-color

An Obsidian plugin for setting colors on folders and files in the file tree.
MIT License
122 stars 9 forks source link

FR: Option to apply to folder backgroud instead of text. #3

Closed brimwats closed 11 months ago

brimwats commented 1 year ago

I am really excited for this plugin because I hate maintaining a bunch of CSS snippets. I'd love to also be able to cover the background or the text (or perhaps both?). I think it would make sense to choose via style settings maybe?

feel free to close this if it's out of scope

ryadaj commented 1 year ago
Thomas-Schmall commented 1 year ago

Yes, I second this one. It makes it nicer looking and more visible.

I did it for now with a CSS snippet. Works smoothly so far - shouldn't be too hard to convert this into a settings-toggle. Even cooler would be an additional transparency setting.

.workspace-leaf-content[data-type="file-explorer"] .nav-files-container .nav-folder-title.file-color-file,
.workspace-leaf-content[data-type="file-explorer"] .nav-files-container .nav-file-title.file-color-file 
{
    background-color: var(--file-color-color);
    color: var(--file-color);
}

Here is a screenshot in the default theme:

Obsidian-File-Color-Background-Css
Thomas-Schmall commented 1 year ago

A little update - since I got some CSS code from eblanshey for implementing this.

For my taste, this helps the readability of the file-explorer a lot. obsidian_-_file-color_snippet_for_subfolders-_default_theme

Here's the code I used (hacky, use with discretion 😁)

.workspace-leaf-content[data-type="file-explorer"] .nav-files-container .mod-root > .nav-folder-children > .nav-folder > .nav-folder-title {
background-color: var(--file-color-color); 
color: var(--text-normal);
opacity: 0.85;
}

.workspace-leaf-content[data-type="file-explorer"] .nav-files-container :not(.mod-root) > .nav-folder-children > .nav-folder > :not(.nav-file-title).nav-folder-title {
 background-color: rgba(80, 170, 255, 0.03);
border-style: dotted;
border-width: 1px;
border-color: var(--file-color-color); 
}
ecustic commented 11 months ago

This is now supported in 1.1.0!