Skip to content

fix: adjust dark mode button style parameters and add soft shadow support / 修复深色模式按钮样式参数并新增柔和投影支持 - #676

Merged
18202781743 merged 1 commit into
linuxdeepin:v25-flowstylefrom
iCancely:flowstyle-button-dark-mode-fix
Sep 4, 2026
Merged

fix: adjust dark mode button style parameters and add soft shadow support / 修复深色模式按钮样式参数并新增柔和投影支持#676
18202781743 merged 1 commit into
linuxdeepin:v25-flowstylefrom
iCancely:flowstyle-button-dark-mode-fix

Conversation

@iCancely

@iCancely iCancely commented Sep 4, 2026

Copy link
Copy Markdown

Summary / 概述

Fix several dark mode (common family) button styling issues on the v25-flowstyle branch, and add soft shadow rendering support for the pressed state.

修复 v25-flowstyle 分支上深色模式(common 系列)按钮的若干样式问题,并为 pressed 状态新增柔和投影渲染支持。

Changes / 变更内容

FlowStyle.qml — dark mode button parameters / 深色模式按钮参数

Parameter / 参数 Before / 修改前 After / 修改后
background1.normalDark.common opacity 1.0 0.6
background2.normalDark.common opacity 1.0 0.6
background1.hoveredDark.common opacity 0.6 0.4
background2.hoveredDark.common opacity 0.6 0.4
background1.pressedDark rgba(1,1,1,0.05) rgba(40,40,40,1)
background2.pressedDark (missing — fell back to normalDark) rgba(46,46,46,1)
dropShadow.pressedDark (missing — fell back to normalDark=transparent) rgba(0,0,0,0.4)
innerShadow1.normalDark rgba(0,0,0,0.5) rgba(0,0,0,0.2)
innerShadow1.hoveredDark rgba(0,0,0,0.6) rgba(0,0,0,0.3)
innerShadow1.pressedDark (missing — fell back to normalDark) transparent
innerShadow2.pressedDark (missing — fell back to normalDark) rgba(255,255,255,0.07)
insideBorder.hoveredDark (missing — fell back to hovered light) transparent
outsideBorder.pressedDark (missing — fell back to normalDark) transparent

Note / 说明: DTK Palette fallback behavior: when pressedDark is missing, Dark+Pressed falls back to Dark+Normal (normalDark), not to pressed (Light). This caused the phantom black inner shadow in pressed state. Adding explicit pressedDark entries fixes this.

说明: DTK Palette 回退机制:当 pressedDark 缺失时,Dark+Pressed 会回退到 Dark+NormalnormalDark),而不是 pressed(浅色)。这导致 pressed 状态下出现了不应有的黑色内阴影。添加显式的 pressedDark 条目即可修复此问题。

BoxPanel.qml — soft shadow rendering / 柔和投影渲染

  • Added a BoxShadow Loader for soft drop shadow rendering when boxShadowBlur > 0.

  • Hard shadow Rectangles (boxShadowBlur === 0) and the soft shadow Loader (boxShadowBlur > 0) are mutually exclusive — only one renders at a time.

  • Gated by enableBoxShadow and enableDropShadow, so checked/highlighted buttons are unaffected.

  • 新增 BoxShadow Loader,当 boxShadowBlur > 0 时渲染柔和投影。

  • 硬投影 RectangleboxShadowBlur === 0)与柔和投影 LoaderboxShadowBlur > 0)互斥,同一时刻只渲染一个。

  • enableBoxShadowenableDropShadow 约束,不影响 checked/highlighted 按钮。

ButtonPanel.qml — pressed shadow blur / pressed 投影模糊

  • boxShadowBlur: pressed state uses blur=1 (soft shadow), normal/hover use 0 (hard shadow).

  • Updated stale comment to reflect the new behavior.

  • boxShadowBlur:pressed 状态使用 blur=1(柔和投影),normal/hover 使用 0(硬投影)。

  • 更新过时注释以反映新行为。

Verification / 验证

  • Compiles cleanly with no warnings (make -j$(nproc) in build-dtk6/).

  • Verified visually in dtk6-exhibition example under dark theme: normal, hover, and pressed states all render correctly.

  • 编译无警告(build-dtk6/make -j$(nproc))。

  • dtk6-exhibition 示例中深色主题下目视验证:normal、hover、pressed 状态均渲染正确。

Summary by Sourcery

Fix dark-mode button appearance and add soft shadows for pressed states.

New Features:

  • Add soft drop-shadow rendering for pressed buttons.

Bug Fixes:

  • Correct dark-mode common button colors, opacity, shadows, and borders across normal, hover, and pressed states.

Enhancements:

  • Use blurred pressed-state shadows while retaining hard shadows for normal and hover states.

…port

Fix several dark mode (common family) button styling issues on the
v25-flowstyle branch:

FlowStyle.qml:
- background1/background2 normalDark: reduce opacity from 1.0 to 0.6
- background1/background2 hoveredDark: reduce opacity from 0.6 to 0.4
- background1/background2 pressedDark: set to (40,40,40,1) / (46,46,46,1)
- dropShadow pressedDark: add (0,0,0,0.4) for visible pressed shadow
- innerShadow1 normalDark: 0.5 -> 0.2, hoveredDark: 0.6 -> 0.3
- innerShadow1 pressedDark: add transparent (fix DTK palette fallback bug)
- innerShadow2 pressedDark: add (255,255,255,0.07) for subtle top highlight
- insideBorder hoveredDark: add transparent (no inner border in dark hover)
- outsideBorder pressedDark: add transparent (no outer border in dark pressed)

BoxPanel.qml:
- Add BoxShadow Loader for soft drop shadow rendering when boxShadowBlur > 0
- Hard shadow Rectangles and soft shadow Loader are mutually exclusive

ButtonPanel.qml:
- boxShadowBlur: pressed state uses blur=1 (soft shadow), normal/hover use 0
- Update stale comment to reflect pressed now uses soft shadow

修复深色模式按钮样式的若干问题(v25-flowstyle 分支):

FlowStyle.qml:
- background1/background2 normalDark 不透明度从 1.0 降至 0.6
- background1/background2 hoveredDark 不透明度从 0.6 降至 0.4
- background1/background2 pressedDark 设为 (40,40,40,1) / (46,46,46,1)
- dropShadow pressedDark: 新增 (0,0,0,0.4) 按压投影
- innerShadow1 normalDark: 0.5 -> 0.2, hoveredDark: 0.6 -> 0.3
- innerShadow1 pressedDark: 新增 transparent(修复 DTK Palette 回退 bug)
- innerShadow2 pressedDark: 新增 (255,255,255,0.07) 顶部高光
- insideBorder hoveredDark: 新增 transparent(深色 hover 无内描边)
- outsideBorder pressedDark: 新增 transparent(深色 pressed 无外描边)

BoxPanel.qml:
- 新增 BoxShadow Loader,当 boxShadowBlur > 0 时渲染柔和投影
- 硬投影 Rectangle 与柔和投影 Loader 互斥,不会同时渲染

ButtonPanel.qml:
- boxShadowBlur: pressed 状态使用 blur=1(柔和投影),normal/hover 使用 0
- 更新过时注释,反映 pressed 现在使用柔和投影
@sourcery-ai

sourcery-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes dark-mode common button palette fallbacks and appearance, and introduces a gated BoxShadow path so pressed buttons render with a soft one-pixel shadow while normal and hovered buttons retain hard shadows.

Flow diagram for button shadow rendering by state

flowchart TD
    State[Button state] --> Select[ButtonPanel selects boxShadowBlur]
    Select -->|normal or hovered: 0| Hard[Hard shadow Rectangles]
    Select -->|pressed: 1| Gate[BoxPanel shadow gates]
    Gate -->|enableBoxShadow and enableDropShadow| Soft[Soft BoxShadow Loader]
    Hard --> Render[Rendered button shadow]
    Soft --> Render
Loading

File-Level Changes

Change Details Files
Correct dark-mode common button palette values and define explicit state-specific fallbacks.
  • Reduce normal and hovered background opacities.
  • Set dark pressed background layers to opaque dark colors.
  • Add dark pressed drop/inner shadow values and remove unintended borders/shadows through transparent entries.
qt6/src/qml/FlowStyle.qml
Add mutually exclusive soft drop-shadow rendering for blurred button shadows.
  • Load BoxShadow only when shadowing is enabled, the selected color is visible, and blur is greater than zero.
  • Keep existing hard-shadow rectangles active only for the zero-blur path through the new conditional behavior.
qt6/src/qml/BoxPanel.qml
Configure pressed buttons to use a one-pixel soft shadow while retaining hard shadows for normal and hovered states.
  • Select blur 1 for pressed state and blur 0 otherwise.
  • Update shadow offsets and comments to document the pressed-state rendering model.
qt6/src/qml/private/ButtonPanel.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@iCancely

iCancely commented Sep 4, 2026

Copy link
Copy Markdown
Author

@18202781743

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, iCancely

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743
18202781743 merged commit 7ace7b9 into linuxdeepin:v25-flowstyle Sep 4, 2026
19 checks passed
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.

3 participants