Hello,
I am trying to customize the voting chips to change the font weight and size. My last attempt was with Gerrit 2.x and I went to edit the GerritSite.css:
/** Vote scores, trying to improve
accessibility */
.voteChip {
font-size: 1.1em;
font-weight: bold;
}
And eventually I found out that GerritSite.css is only for styling the header/footer, aka the main document. I have learned the hard way that everything else are in shadow dom (new concept to me) which completely isolate those DOM from the main stylesheet.
The html for the component seems to be defined in
polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts
.voteChip {
display: flex;
justify-content: center;
margin-right: var(--spacing-s);
padding: 1px;
@apply --vote-chip-styles;
border: 1px solid var(--border-color);
}
Looking a bit at Polymer documentation, it seems the sole way to style a component is to have them define each of the css property that can be stylable using a variable and the end user can then override the var. So I would need to add to Gerrit core:
.voteChip {I am suspicious that any style tweak that has not been envisioned in Gerrit core would require a code adjust and a new release of Gerrit. There must be another way to override a Polymer component styling but I haven't found any lead.
Maybe that is how Polymer is thought about: locking down customization of components?
An alternative is to crawl through the levels of shadow dom to find the component and dynamically adjust its style, but that sounds like "a lot" of effort.
Have I missed a Polymer API that would let me
easily retrieve the defined component (ie without crawling the
dom) and then adjust its style?
Any guidance welcome :]
-- Antoine "hashar" Musso Release Engineering
On 17 Mar 2021, at 09:59, Antoine Musso <amu...@wikimedia.org> wrote:Hello,
I am trying to customize the voting chips to change the font weight and size. My last attempt was with Gerrit 2.x and I went to edit the GerritSite.css:
/** Vote scores, trying to improve accessibility */
.voteChip {
font-size: 1.1em;
font-weight: bold;
}And eventually I found out that GerritSite.css is only for styling the header/footer, aka the main document. I have learned the hard way that everything else are in shadow dom (new concept to me) which completely isolate those DOM from the main stylesheet.
The html for the component seems to be defined in polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts
.voteChip {
display: flex;
justify-content: center;
margin-right: var(--spacing-s);
padding: 1px;
@apply --vote-chip-styles;
border: 1px solid var(--border-color);
}
Looking a bit at Polymer documentation, it seems the sole way to style a component is to have them define each of the css property that can be stylable using a variable and the end user can then override the var. So I would need to add to Gerrit core:
.voteChip {
+ font-size: var(--font-size);
+ font-weight: var(--font-weight);
}
I am suspicious that any style tweak that has not been envisioned in Gerrit core would require a code adjust and a new release of Gerrit. There must be another way to override a Polymer component styling but I haven't found any lead.
Maybe that is how Polymer is thought about: locking down customization of components?
An alternative is to crawl through the levels of shadow dom to find the component and dynamically adjust its style, but that sounds like "a lot" of effort.
Have I missed a Polymer API that would let me easily retrieve the defined component (ie without crawling the dom) and then adjust its style?
Any guidance welcome :]
-- Antoine "hashar" Musso Release Engineering
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/42e15c12-6568-ecd2-d19c-2f756e8a95f4%40wikimedia.org.
I am trying to customize the voting chips to change the font weight and size.
I am suspicious that any style tweak that has not been envisioned in Gerrit core would require a code adjust and a new release of Gerrit. There must be another way to override a Polymer component styling but I haven't found any lead.
Maybe that is how Polymer is thought about: locking down customization of components?
An alternative is to crawl through the levels of shadow dom to find the component and dynamically adjust its style, but that sounds like "a lot" of effort.
Have I missed a Polymer API that would let me easily retrieve the defined component (ie without crawling the dom) and then adjust its style?
Any guidance welcome :]
-- Antoine "hashar" Musso Release Engineering
--