Skip to content

fix: prevent dark mode styles from being used when using light mode#82

Open
pzhlkj6612 wants to merge 1 commit into
hibikilogy:masterfrom
pzhlkj6612:fix/light-mode-dark-disabled-buttons
Open

fix: prevent dark mode styles from being used when using light mode#82
pzhlkj6612 wants to merge 1 commit into
hibikilogy:masterfrom
pzhlkj6612:fix/light-mode-dark-disabled-buttons

Conversation

@pzhlkj6612
Copy link
Copy Markdown
Contributor

Fix #81.

The AI told me to make this fix, then I tried and it worked. Let me try explaining it:

We have @import "dark-mode.less" in "hux-blog.less":

@import "variables.less";
@import "mixins.less";
@import "sidebar.less";
@import "side-catalog.less";
@import "dark-mode.less";

In "variables.less" we have @disabled-bg: @light-disabled-bg, while in "dark-mode.less" we have @disabled-bg: @dark-disabled-bg:

@disabled-bg: @light-disabled-bg;
@disabled-text: @light-disabled-text;

@disabled-bg: @dark-disabled-bg;
@disabled-text: @dark-disabled-text;

Later @imports overrides earlier defined variable. As a result, we got the wrong background color here:

.disabled {
>a,
>a:hover,
>a:focus,
>span {
color: @gray;
background-color: @disabled-bg;
cursor: not-allowed;
pointer-events: none;
}
}
}

That's why we couldn't see !important in the wrong style of these buttons in light mode.

We don't need to import "dark-mode" style into "hux-blog" style because:

  1. the dark mode CSS has already been loaded by "head.html":

    <!-- Custom CSS -->
    <link rel="stylesheet" href="{{ "/css/hux-blog.min.css" | prepend: site.baseurl }}">
    <!-- Dark Mode CSS -->
    <link rel="stylesheet" href="{{ "/css/dark-mode.css" | prepend: site.baseurl }}">

  2. That looks really like a bug.

.

@NozoMizore7 NozoMizore7 requested a review from inchei May 11, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

浅色模式下的失效翻页按钮为深色

1 participant