new-xkit / XKit

Fork of XKit, the extension framework for Tumblr
https://new-xkit-extension.tumblr.com
Other
459 stars 135 forks source link

Fix for OCP AlreadyReblogged icon color change #2099

Open nobodysuspectsthebutterfly opened 2 years ago

nobodysuspectsthebutterfly commented 2 years ago

Re issue #2098: https://github.com/new-xkit/XKit/issues/2098

A tumblr update changed the selector and property for the reblog icon; this fixes the css so that AlreadyReblogged turns green as expected. Couldn't get the selector [style="--icon-color-primary:rgba(var(--black), 0.65)"] to work properly for some reason, but at least this works.

AprilSylph commented 2 years ago

The reason targeting [style="--icon-color-primary: rgba(var(--black), 0.65);"] doesn't work with the current CSS is because it's targeting an inline style and applying a non-inline style. Inline styles (those applied with the style attribute) always have higher specificity, so it does nothing.

Two solutions to this:

The reason we filter to grey reblog buttons only is to avoid clashes with Tumblr's own changing colours. Without it, AlreadyReblogged turns reblog buttons almost permanently green, overriding e.g. the purple that appears when using Tumblr's native fast-queue feature.

AprilSylph commented 2 years ago

Hm, actually it looks like Tumblr is not setting that style with perfect consistency, and there's a couple more variations that do the same thing... how annoying. We can't use RegExp in CSS selectors so I guess something more vague like [style*="--black"] will have to do.

marcustyphoon commented 1 year ago

For reference, the CSS used in XKit Rewritten can be seen here: https://github.com/AprilSylph/XKit-Rewritten/commit/48aaf7fd1b3d7d27982b983a33903e17493824e7