Following up from JENKINS-73167">JENKINS-73167 :
Comparing hard-coded style values of Badge 1.9.1 to Badge 1.10 which introduced CSS styles (and unfortunately lost the style contents, as pursued in that referenced issue), I think it makes sense for both Badge and Groovy PostBuild plugins to extend the possible parameters of their addShortText() methods with a new option (keeping legacy code for colors/borders intact) to set a CSS style name instead-of/additionally-to those legacy values, with the Jenkins deployment free to define such style in the custom CSS file at $JENKINS_HOME/userContent/something.css linked in controller's configuration.
So instead of hard-coding color and thickness numbers in my call, I'd tell addShortText to, for example, add a style="badge-error" to the list of styles for the entry (built-in ones being fallback for un-customized values). There would be less HTML mark-up generated, and the site design would be more future-proof (or theme-proof) thanks to CSS.
Originally reported by
jimklimov, imported from: Extend addShortText() with ability to set a CSS style inaddition to (or even instead of) specific colors and thickness values
- assignee:
bakito
- status: Open
- priority: Minor
- component(s): badge-plugin, groovy-postbuild-plugin
- resolution: Unresolved
- votes: 0
- watchers: 1
- imported: 20251216-225446
Raw content of original issue
Following up from JENKINS-73167 :
Comparing hard-coded style values of Badge 1.9.1 to Badge 1.10 which introduced CSS styles (and unfortunately lost the style contents, as pursued in that referenced issue), I think it makes sense for both Badge and Groovy PostBuild plugins to extend the possible parameters of their addShortText() methods with a new option (keeping legacy code for colors/borders intact) to set a CSS style name instead-of/additionally-to those legacy values, with the Jenkins deployment free to define such style in the custom CSS file at $JENKINS_HOME/userContent/something.css linked in controller's configuration.
So instead of hard-coding color and thickness numbers in my call, I'd tell addShortText to, for example, add a style="badge-error" to the list of styles for the entry (built-in ones being fallback for un-customized values). There would be less HTML mark-up generated, and the site design would be more future-proof (or theme-proof) thanks to CSS.
environment
Jenkins LTS 2.452.1<br/>
Badge 1.10+<br/>
Groovy PostBuild plugin 228.vcdb_cf7265066
Following up from JENKINS-73167">JENKINS-73167 :
Comparing hard-coded style values of Badge 1.9.1 to Badge 1.10 which introduced CSS styles (and unfortunately lost the style contents, as pursued in that referenced issue), I think it makes sense for both Badge and Groovy PostBuild plugins to extend the possible parameters of their addShortText() methods with a new option (keeping legacy code for colors/borders intact) to set a CSS style name instead-of/additionally-to those legacy values, with the Jenkins deployment free to define such style in the custom CSS file at $JENKINS_HOME/userContent/something.css linked in controller's configuration.
So instead of hard-coding color and thickness numbers in my call, I'd tell addShortText to, for example, add a style="badge-error" to the list of styles for the entry (built-in ones being fallback for un-customized values). There would be less HTML mark-up generated, and the site design would be more future-proof (or theme-proof) thanks to CSS.
Originally reported by
jimklimov, imported from: Extend addShortText() with ability to set a CSS style inaddition to (or even instead of) specific colors and thickness values
Raw content of original issue
environment