I have long had an issue with colorising buttons, not that I use in wiki text but soon as I put them into a toolbar such as the viewtoolbar or Page controls.
I believe it is the automatic coloring and on hover built into tiddlywikis core stylesheets or themes, or the toolbar classes that cause this.
Can anyone tell me how to apply a color inside a class, span or the actual SVG tiddler such that when used in the view toolbar I regain control of its color and background color, and ideally a way to pick a hover color to match?
I am keen to point to a different coloured tiddler or set the color within the button definition according to a status/condition.
I have tried overriding and replacing the existing CSS with no sucess.
Please help
Ideally we could find a stylesheet which when installed we can assign a class to the button widget that permits the button colour to be set within the button or just use the SVG’s existing fill style.
That is I just want tiddlywiki css or part there of to P–s off when I do not want it.
The only issue is I would prefer to assign the foreground colour, specifically the fill, or let it come through from the actual svg (ie as set in the svg).
I also want to do this programmatically, ie determine the status and color accordingly only on the current tiddler.
how do I name my button? ie where do I put “mybutton” in the button definition.
is it an additional class?
Another way to ask for this is I would like if possible to add a color via a class in the button definition that overrides the effects of the classes that operate on the viewToolBar and Page Controls?
For example a set of traffic light colours red yellow green and perhaps caution (orange) and default (grey) available (blue). As long as the stylesheet is present these could then be used on any button (definition)
There is a problem with the Specifity of selectors in the styles when put in the toolbar, your styles have lower specifity than the original styles of button and svg in toolbars. To solve you need to have a value of specifity equal or highter than the default styles.
About currentcolor, it is a “keyword” to use the value of the property color, it is the setted or inherited value.
Yes, perhaps this is the problem, the svg inside the toolbar have a specificity that we can’t over ride from within the button definition. I kind of understand it, but not completely. I want to create buttons such that either;
I can programmatically change the color within the button definition such that when displayed on the toolbar it becomes that color
Or in a way so that the actual color of the svg (its fill) is honored.
There may be another issue and that is to ensure the toolbar is refreshed so the color once changed becomes visible.
I plead ignorant here, but it seem to me such a basic need for someone designing buttons to control the color of the button. Either a suitable work around or ideal a redesign to make it possible a core override (whilst maintaining default values (or a core change be developed to designers can access this basic function).
I admit this has perplexed me many times, and I have wasted hours on this. Kind people make suggestions and recommendations but usually give me static solutions that I cant control programmatically. For example I am so close to completing a generic toggle button that shows on/off and unset, including colors but just cant get the last few meters. I have build a single tiddler button that can be cloned and used as a toggle for anything, be it a tag or field existence. But what use is a toggle if you cant see it get toggled.
I think you may understand sometimes it is possible to ask the right question - describe what I want, but not ask a technical question when I don’t have the technical knowledge to implement something that should be simple, and documented.
I have learned a lot about CSS trying to solve this but it is clearly not enough.
Here is my button, I need to go to bed for now, its 1am here, perhaps the css gods will find a way, while I sleep?
@TW_Tones, one clue is a toggled button itself is not necessarily reflecting a changed “link state” … but IF you have a changed “link state” then CSS should work without refresh for any of it’s states …
It is a solution, but there are other problems with the specifity.
@TW_Tones , if you want change between color you must have the color stored in anywhere, for example in a macro or in the stylesheet. I prefer the 2nd, and then I can change between classes (red, green, …) using macro/flters but you have to solve the specifity. There is a alternative, but it is using styles inline, but you also need to solve the specifity of svg using the “currentcolor”.
In both ways, you can use a macro/filter to switch the class or the style.
Here a basic example for the alternative with inline styles.
This may not be helpful, but there is a CSS property called !important which can be used to override style rules from different locations in the cascade:
I was “wrong” when I thinking in macros for programmatically the button, the macro would be used for create the button, but where determine the status you need the transclusion. So you could use the macro to create a button with the changes that you need (in filter and in the whole button)
The core of the button would be something like this.
The use the !important should be the last solution because it “break” the specifity, and in the future you will enter in vicious cicle of !important.
That’s right. … But that should be the very very last resort, because !important is toxic. .. If you publish a stylesheet that contains !important an other user needs to use !important !important to get rid of it. … That’s why I call it “toxic”