shabegom / buttons

Buttons in Obsidian
The Unlicense
455 stars 47 forks source link

Background still not working with custom class #140

Closed willasm closed 1 year ago

willasm commented 1 year ago

As the subject title says, background color still not working with custom class in Obsidian v1.0. It is fixed for the settings defaults though and it works with the style settings plugin as well.

Not a big deal if it is fixed in the upcoming v1.0. Sounds well worth the wait!!

shabegom commented 1 year ago

Hmmm I suppose the same issue would happen with a custom class as it did with the color options..it needs to be targeted more specifically to button elements.

Try changing your class definition in the snippet from custom-class to button.custom-class (replace custom-class with your class name)

willasm commented 1 year ago

Thanks, I did eventually get it to work . I had to rename my snippet class name from ".button-nav" to ".button.button-nav" and in the button definition I had to set the class definition to "class button button-nav". Note there is no period between button and button-nav. If I add the period I lose the normal background but the on hover works. I have tried every other combination I can think of but this is the only one that works. At any rate it does work now!

Really looking forward to v1.0! Thanks again, William.

shabegom commented 1 year ago

Yeah I'm not sure how to make this any easier for folks since all the plugin does is append the class name to the list of classes on the element and the app is adding the color in a way that it takes priority.

willasm commented 1 year ago

I assumed that is how it was done, makes total sense to me. Happy that I got it working anyhow. The list of changes and features in v1.0 look really impressive, looking forward to it!

willasm commented 1 year ago

Just want to leave this update should someone else have a similar issue. It does not like the dash "-" in ".button.button-nav" that I was using, changed it to just ".button.button" and now I can just use "class button" in the button definition.