StylishThemes/Wikipedia-Dark

Potential lack of specificity with colour rules; false positives

ColonelGerdauf opened this issue · 2 comments

There are rules such as div[style*="background: #FFF"]. That causes awkwardness for situations like when colour is #FFFAF0

That would make the colour swatch for 'floral white' [Citation] disappear due to the faulty match clause.

And with that specific example, I have noticed the exact same rule in different sets, which creates potentially conflicting rules.

Maybe a :not(.color_swatch) > div[style*="background: #000"] can help in those kinds of situations.

Yeah that's a problem with how we have to match the inline styles on the elements. Wikipedia, and other MediaWikis by nature, have an overabundance of inline styles that make targeting and overriding them with CSS rather difficult. This is especially true when you're trying not to break other elements of the page, or other unrelated pages in the process. There are a lot of over or under specified selectors exacerbated by !important (and :not() as you suggest above).

Things have gotten better with the adoption of TemplateStyles for most common templates, but WikiTables with inline styles and other types of inline elements are still prevalent everywhere. This will continue to be the case as long as editors are manipulating styles with their edits.

There is also a lot of legacy baggage with how this user style is structured. The MediaWiki interface changes constantly, and older style overrides aren't always removed when that happens. An attempt to rewrite it from scratch and structuring it with the goal of minimizing these malformed selectors and reducing collateral damage would be a massive undertaking, given the complexity of MediaWiki in general, and Wikipedia in particular.

This is one of the reasons we decided that a style generator similar to GitHub-Dark would be the best path forward, though none of us have had much time lately to make progress on that front. If you're interested in tackling the specificity problem (or any other issues), feel free to submit a pull request.