Skip to content

[3.0] Theme split (wave 6, part 2) — reach the last colours the colour mode could not - #9548

Open
albertlast wants to merge 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-shorthand-border-tokens
Open

[3.0] Theme split (wave 6, part 2) — reach the last colours the colour mode could not#9548
albertlast wants to merge 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-shorthand-border-tokens

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Two kinds of value were still out of the dark mode's reach, and neither was visible to the sweep that tokenised the rest of the theme.

A border written as a shorthand

That sweep matched border and border-*-color, so a border-bottom: 1px solid #bbb went straight past it. Seventeen were left, across index.css, attachments.css, responsive.css, profile.css and the two right-to-left sheets:

#inner_wrap the hairline under the header
.list_posts the rule above a post list
#post_draft_options the draft panel's left edge and its row separators
.errorfile_table td.current the highlighted line in the error file viewer
#postAttachment the dotted rule between attachment previews
#attachment_upload.dz-drag-hover the drop zone's hover outline
#mobile_action .notify_dropdown a the mobile notification list
.up_contain .lastpost the board index's last-post block
.buttonrow, table.weeklist the RTL button row and week grid separators

Each is now a token holding the literal it replaced.

A token that was never declared

This one is subtler. atwho.css writes every one of its nineteen custom properties with a fallbackvar(--mentions-bg, #fff) — so the mentions list has never looked wrong and nothing flagged it. But a token that is never declared cannot be overridden either, which is exactly what kept that list white in dark mode.

Declaring them, each from the fallback it is written with, is the whole fix. atwho.css itself is untouched, so it still works if a theme drops variables.css — the fallbacks stay as the safety net they were written to be.

The one literal deliberately left anywhere is the diagonal stripe over a progress bar's fill, which is a translucent white texture rather than a colour. Excluding variables.css and dark.css, which are where literals belong, and the standalone installer/maintenance/report pages and the editor iframe sheet, which no colour mode reaches, the theme's stylesheets now hold exactly one literal colour between them.

Verification

Computed colours, border widths and styles, shadows, sizes, weights and radii for every element over fourteen pages, before and after:

baseline records: 4473
after    records: 4473
LIGHT-MODE DIFFERENCES: 0

And the same properties now actually move in dark mode rather than staying light:

light dark
#inner_wrap bottom border rgb(187, 187, 187) rgb(58, 67, 74)
#detailedinfo dl bottom border rgb(204, 204, 204) rgb(58, 67, 74)
--mentions-bg #fff hsl(207, 14%, 19%)
--mentions-item-color hsl(0, 0%, 20%) hsl(207, 10%, 84%)

Stacked on #9547 (wave 6, part 1), because profile.css is one of the files it corrects.

Part 2 of wave 6 of the #7933 split.

Issues References (Fixes|Related|Closes)

Related #7933

index.css carried a "profile section" of about three hundred lines that every
page in the forum downloaded. This moves the part of it that only the profile
draws into a profile.css, loaded from SMF\Actions\Profile\Main beside the
profile.js it already loads there.

Only part of it moved, and which part is the whole question. That section is not
profile-scoped despite its heading: the post list it holds is the same one the
moderation centre, personal messages, recent posts and search all render, the
board picker is shared with search, and the paid subscription, theme picker and
theme settings blocks belong to the admin centre. It also opens with a bare
`dl { overflow: auto; }`, which is a global rule that happens to sit under the
heading. Moving the section wholesale would have unstyled all of those.

So every selector was resolved against the templates that actually emit it,
matching class and id attributes rather than bare words, and a rule moved only
when the leftmost element of every one of its branches is something no template
but the profile emits. Thirty-five rules moved on that test and thirty stayed.

Two rules went out entirely rather than moving: .sizefix and .topic .mod_icons
name classes that nothing in Themes/ or Sources/ emits at all.

Verified against a running forum: the computed colours, box metrics, display,
float, margins, padding, font size and alignment of every element on
twenty-two pages - all eleven profile areas, plus the five that share those
selectors, the two admin pages that own the blocks left behind, the reminder,
the memberlist, the stats and the board index - before and after. 7260
elements, no differences.

Signed-off-by: Mathias Alberts <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Two kinds of value were still out of the dark mode's reach, and neither was
visible to the sweep that tokenised the rest of the theme.

The first is a border written as a shorthand. That sweep matched `border` and
`border-*-color`, so a `border-bottom: 1px solid #bbb` went straight past it.
Seventeen of those were left, across index.css, attachments.css,
responsive.css, profile.css and the two right-to-left sheets: the hairline
under the header, the one above a post list, the dotted rule between attachment
previews, the drop zone's hover outline, the mobile notification list, and the
week grid separators. Each is now a token holding the literal it replaced.

The second is subtler. atwho.css writes every one of its nineteen custom
properties with a fallback - `var(--mentions-bg, #fff)` - so the mentions list
has never looked wrong and nothing flagged it. But a token that is never
declared cannot be overridden either, which is exactly what kept that list
white in dark mode. Declaring them, each from the fallback it is written with,
is the whole fix; atwho.css itself is untouched, so it keeps working if a theme
drops variables.css.

The one literal deliberately left is the diagonal stripe over a progress bar's
fill, which is a translucent white texture rather than a colour.

Light mode is unchanged: computed colours, border widths and styles, shadows,
sizes, weights and radii for every element over fourteen pages, before and
after - 4473 elements, no differences. In dark mode the same properties now
resolve against the scale rather than staying at their light values.

Signed-off-by: Mathias Alberts <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007

Copy link
Copy Markdown
Member

Will review this after part 1 merges and we rebase this to show the actual changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants