Skip to content

Conversation

discreted66
Copy link
Collaborator

@discreted66 discreted66 commented Feb 26, 2025

PR

组件支持暗色主题

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style
    • Enhanced visual interactions with improved hover, active, and disabled states across icons, text areas, buttons, and dialogs for a more responsive interface.
    • Introduced new CSS variables for dynamic styling of various components, including icons and buttons.
    • Updated color properties for better theming consistency across components.
  • Theme
    • Unified color schemes and refined styling deliver a consistent look across components.
    • Removed the deprecated dark theme option, streamlining available appearance settings.

Copy link

coderabbitai bot commented Feb 26, 2025

Warning

Rate limit exceeded

@discreted66 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between be7da19 and 2ca8618.

📒 Files selected for processing (33)
  • examples/sites/demos/pc/app/filter-panel/code-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/filter-panel/code.vue (2 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/basic-usage.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/list-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/icon/list.vue (2 hunks)
  • examples/sites/demos/pc/app/icon/show-title-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/show-title.vue (1 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width.vue (1 hunks)
  • packages/theme/src/anchor/vars.less (1 hunks)
  • packages/theme/src/calendar-view/index.less (3 hunks)
  • packages/theme/src/calendar-view/vars.less (1 hunks)
  • packages/theme/src/filter-box/index.less (2 hunks)
  • packages/theme/src/filter-box/vars.less (1 hunks)
  • packages/theme/src/loading/vars.less (1 hunks)
  • packages/theme/src/picker/index.less (6 hunks)
  • packages/theme/src/picker/vars.less (1 hunks)
  • packages/theme/src/pop-upload/index.less (2 hunks)
  • packages/theme/src/pop-upload/vars.less (1 hunks)
  • packages/theme/src/scroll-text/vars.less (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/search/vars.less (1 hunks)
  • packages/theme/src/steps/index.less (6 hunks)
  • packages/theme/src/steps/vars.less (1 hunks)
  • packages/theme/src/tabs/index.less (3 hunks)
  • packages/theme/src/tabs/vars.less (1 hunks)
  • packages/theme/src/upload-list/index.less (1 hunks)
  • packages/theme/src/wizard/vars.less (1 hunks)
  • packages/vue/src/calendar/src/pc.vue (1 hunks)
  • packages/vue/src/search/src/pc.vue (1 hunks)

Walkthrough

This pull request applies a series of CSS and styling refinements across multiple Vue component files and theme packages. The changes include switching CSS processing to Less, removing fixed color values in favor of CSS variables, adding new pseudo-element rules, and adjusting hover states, spacing, and typography. Additionally, minor template and constant cleanups were made in both demo examples and core theme files, ensuring a more dynamic and consistent visual presentation across components.

Changes

File(s) Change Summary
examples/sites/demos/pc/app/filter-panel/code-composition-api.vue
examples/sites/demos/pc/app/filter-panel/code.vue
Updated <style> tags to use lang="less"; added new pseudo-element rules for .tiny-filter-panel-textarea :deep(.tiny-textarea) to enhance visual styling.
examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue
examples/sites/demos/pc/app/icon-multicolor/list.vue
examples/sites/demos/pc/app/icon/list-composition-api.vue
examples/sites/demos/pc/app/icon/list.vue
examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue
examples/sites/demos/pc/app/icon/basic-usage.vue
examples/sites/demos/pc/app/icon/show-title-composition-api.vue
examples/sites/demos/pc/app/icon/show-title.vue
Removed fixed fill: #000; styles and introduced new fill and color properties that reference CSS variables, standardizing icon appearance and enabling dynamic hover effects.
examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue
examples/sites/demos/pc/app/time-line/set-node-width.vue
Added a new CSS rule (color: #000;) for <code> elements to improve text visibility.
Multiple files under packages/theme/src/** (e.g., anchor/vars.less, calendar-view/*, filter-box/*, loading/vars.less, picker/index.less, pop-upload/*, scroll-text/vars.less, search/*, steps/*, tabs/*, upload-list/index.less, wizard/vars.less, picker/vars.less) Updated various CSS variables, hover styles, spacing, and active state properties to refine component theming and visual consistency across anchor, calendar view, filter box, loading mask, picker, pop-upload, scroll text, search, steps, tabs, upload list, wizard, and related theme modules.
packages/vue/src/calendar/src/pc.vue
packages/vue/src/picker/src/pc.vue
packages/vue/src/search/src/pc.vue
examples/sites/src/const.ts
In Vue files, removed the type="primary" attribute from a Button, simplified the picker suffix template by removing a <transition> wrapper and merging class names, changed an input’s background style to inherit, and removed the dark theme import and mapping from the theme tool constants.

Possibly related PRs

Hop, hop, here I come, a code rabbit on the run,
Tweaking styles under the moon and sun.
Less now guides our CSS flight,
Variables gleam, oh what a sight!
Hopping through themes with a joyful heart,
Each change a carrot – a brand new start!
🐰💻


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Feb 26, 2025
Copy link

Walkthrough

此PR为组件添加了对暗色主题的支持,涉及多个文件的样式调整和变量修改,以适应暗色主题的需求。主要更改包括样式文件中颜色变量的调整和组件样式的更新。

Changes

文件 概要
examples/sites/demos/pc/app/filter-panel/code-composition-api.vue, examples/sites/demos/pc/app/filter-panel/code.vue 修改样式语言为less,调整textarea的背景继承属性。
examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue, examples/sites/demos/pc/app/icon-multicolor/list.vue 移除图标的fill属性以适应主题变化。
examples/sites/demos/pc/app/icon/list-composition-api.vue, examples/sites/demos/pc/app/icon/list.vue 调整hover状态下的颜色和图标填充。
examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue, examples/sites/demos/pc/app/time-line/set-node-width.vue 为code元素添加颜色属性。
packages/theme/src/anchor/vars.less 修改线条背景色变量。
packages/theme/src/base/reset.less 添加fill和color变量。
packages/theme/src/calendar-view/index.less, packages/theme/src/calendar-view/vars.less 调整radio按钮的背景和图标颜色。
packages/theme/src/filter-box/index.less, packages/theme/src/filter-box/vars.less 更新按钮的文本颜色和hover状态。
packages/theme/src/input/index.less 注释掉fill属性。
packages/theme/src/loading/vars.less 修改加载背景色变量。
packages/theme/src/picker/index.less 调整图标hover状态下的颜色。
packages/theme/src/pop-upload/index.less, packages/theme/src/pop-upload/vars.less 添加表格文本颜色变量。
packages/theme/src/scroll-text/vars.less 修改背景色变量。
packages/theme/src/search/index.less, packages/theme/src/search/vars.less 更新选择器文本颜色变量。
packages/theme/src/steps/index.less, packages/theme/src/steps/vars.less 调整步骤组件的颜色和图标填充。
packages/theme/src/tabs/index.less, packages/theme/src/tabs/vars.less 修改tabs组件的背景和边框颜色。
packages/theme/src/upload-list/index.less 更新hover状态下的文本颜色。
packages/theme/src/wizard/vars.less 修改时间线节点的背景色变量。
packages/vue/src/calendar/src/pc.vue 移除Button组件的primary类型。
packages/vue/src/picker/src/pc.vue 调整组件的显示逻辑和样式。
packages/vue/src/search/src/pc.vue 修改背景属性为inherit。
🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Copy link

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Walkthrough

This PR adds support for dark themes to the component, involving style adjustments and variable modifications of multiple files to suit the needs of dark themes. The main changes include adjustments to color variables in the style file and updates to component styles.

Changes

Documents Summary
examples/sites/demos/pc/app/filter-panel/code-composition-api.vue, examples/sites/demos/pc/app/filter-panel/code.vue Modify the style language to less and adjust the textarea Background inheritance attributes.
examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue, examples/sites/demos/pc/app/icon-multicolor/list.vue Remove the fill attribute of the icon to fit the theme change.
examples/sites/demos/pc/app/icon/list-composition-api.vue, examples/sites/demos/pc/app/icon/list.vue Adjust the color and icon fill in the hover state.
examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue, examples/sites/demos/pc/app/time-line/set-node-width.vue Add color attributes to the code element.
packages/theme/src/anchor/vars.less Modify the line background color variable.
packages/theme/src/base/reset.less Add fill and color variables.
packages/theme/src/calendar-view/index.less, packages/theme/src/calendar-view/vars.less Adjust the background and icon color of the radio button.
packages/theme/src/filter-box/index.less, packages/theme/src/filter-box/vars.less Update the text color and hover status of the button.
packages/theme/src/input/index.less Comment out the fill property.
packages/theme/src/loading/vars.less Modify the load background color variable.
packages/theme/src/picker/index.less Adjust the color of the icon hover state.
packages/theme/src/pop-upload/index.less, packages/theme/src/pop-upload/vars.less Add a table text color variable.
packages/theme/src/scroll-text/vars.less Modify background color variables.
packages/theme/src/search/index.less, packages/theme/src/search/vars.less Update the selector text color variable.
packages/theme/src/steps/index.less, packages/theme/src/steps/vars.less Adjust the color and icon fill of the step component.
packages/theme/src/tabs/index.less, packages/theme/src/tabs/vars.less Modify the background and border color of the tabs component.
packages/theme/src/upload-list/index.less Update the text color in the hover state.
packages/theme/src/wizard/vars.less Modify the background color variable of the timeline node.
packages/vue/src/calendar/src/pc.vue Remove the primary type of Button component.
packages/vue/src/picker/src/pc.vue Adjust the display logic and style of the component.
packages/vue/src/search/src/pc.vue Modify the background attribute to inherit.
🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Copy link

It seems like you've shared a detailed walkthrough of a pull request that adds support for dark themes to a component in the opentiny/tiny-vue project. The changes involve style adjustments and variable modifications across multiple files to accommodate dark themes. If you have any specific questions or need further assistance regarding this PR or any other aspect of opentiny/tiny-vue, feel free to ask!

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/sites/demos/pc/app/icon/list-composition-api.vue (1)

105-112: Consider using CSS variables for hover colors.

While the hover effects enhance the UI, using hardcoded color values (#191919) may not fully support dark themes. Consider using CSS variables for better theme compatibility.

 .svgs-item:hover {
   background-color: #f6f8fa;
-  color: #191919;
+  color: var(--tv-color-text-active, #191919);
 }

 .svgs-item:hover .svgs-icon {
-  fill: #191919;
+  fill: var(--tv-color-icon-active, #191919);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 985be78 and 75ec1d5.

📒 Files selected for processing (30)
  • examples/sites/demos/pc/app/filter-panel/code-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/filter-panel/code.vue (2 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/list-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/list.vue (2 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width.vue (1 hunks)
  • packages/theme/src/anchor/vars.less (1 hunks)
  • packages/theme/src/base/reset.less (1 hunks)
  • packages/theme/src/calendar-view/index.less (3 hunks)
  • packages/theme/src/calendar-view/vars.less (1 hunks)
  • packages/theme/src/filter-box/index.less (2 hunks)
  • packages/theme/src/filter-box/vars.less (1 hunks)
  • packages/theme/src/loading/vars.less (1 hunks)
  • packages/theme/src/picker/index.less (6 hunks)
  • packages/theme/src/pop-upload/index.less (2 hunks)
  • packages/theme/src/pop-upload/vars.less (1 hunks)
  • packages/theme/src/scroll-text/vars.less (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/search/vars.less (1 hunks)
  • packages/theme/src/steps/index.less (6 hunks)
  • packages/theme/src/steps/vars.less (1 hunks)
  • packages/theme/src/tabs/index.less (3 hunks)
  • packages/theme/src/tabs/vars.less (1 hunks)
  • packages/theme/src/upload-list/index.less (1 hunks)
  • packages/theme/src/wizard/vars.less (1 hunks)
  • packages/vue/src/calendar/src/pc.vue (1 hunks)
  • packages/vue/src/picker/src/pc.vue (1 hunks)
  • packages/vue/src/search/src/pc.vue (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/theme/src/scroll-text/vars.less
  • examples/sites/demos/pc/app/time-line/set-node-width.vue
  • examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue
🔇 Additional comments (46)
packages/theme/src/pop-upload/vars.less (1)

32-33: Good addition of a theme variable for dark theme support.

The new variable --tv-PopUpload-table-body-col-color references the general text color variable --tv-color-text, which is a good practice for theme compatibility. This will ensure text in the pop-upload table is properly visible in both light and dark themes.

examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue (1)

9-9: Appropriate removal of hardcoded fill color.

Removing the hardcoded fill: #000; style property allows the icon to inherit its color from the theme, making it compatible with dark themes. This change aligns with the PR's objective of adding dark theme support.

packages/theme/src/upload-list/index.less (1)

41-43: Good replacement of hardcoded color with a theme variable.

Replacing the fixed hover color with the CSS variable --tv-UploadList-item-hover-text-color allows the component to adapt to different themes. This ensures proper contrast and visibility in dark mode.

examples/sites/demos/pc/app/icon-multicolor/list.vue (1)

9-9: Appropriate removal of hardcoded fill color.

Removing the hardcoded fill: #000; style property allows the icon to inherit its color from the theme, making it compatible with dark themes. This change is consistent with the equivalent modification in the composition API version.

packages/theme/src/search/index.less (1)

194-194: Good improvement to variable naming consistency

The change from --tv-Search-selector-text to --tv-Search-selector-text-color improves naming clarity and maintains consistency with other color variables in the file that already use the -color suffix. This makes it clear that this variable is specifically for a color value.

packages/theme/src/pop-upload/index.less (2)

65-65: Consistent text coloring added for dialog tips

Adding this color variable helps ensure consistent text coloring in dark themes. Good enhancement for theme support.


99-99: Consistent text coloring added for table body columns

Adding the same color variable to table body columns ensures consistent text appearance throughout the component. This is important for proper dark theme support.

packages/vue/src/calendar/src/pc.vue (1)

100-102: Removed primary button styling for better theme flexibility

Removing the type="primary" attribute allows the button to use default styling, which is likely more adaptable to theme changes. This is a good adjustment for dark theme support where the primary button styling might be too prominent or conflict with the dark background.

packages/theme/src/loading/vars.less (1)

19-19: Improved loading mask visibility for dark themes

Changing the loading mask background color to var(--tv-color-bg-active-dark) enhances visibility in dark themes. This provides better contrast for the loading indicator against darker backgrounds, improving user experience.

packages/theme/src/base/reset.less (1)

44-45: Good addition of CSS variables for icon colors.

These new CSS properties enable proper color theming for SVG icons by using variables instead of hardcoded values. This is essential for dark theme support, allowing icons to adapt their colors based on the current theme setting.

packages/theme/src/steps/vars.less (1)

261-262: Well-documented variable for timeline component theming.

The addition of the --tv-Steps-border-left-color variable with clear documentation helps maintain consistency in the UI when switching between light and dark themes. This is a good practice for component theming.

packages/theme/src/search/vars.less (1)

57-57: Appropriate update to search dropdown background variable.

Changing the selector background color variable from var(--tv-color-bg-secondary) to var(--tv-color-bg-2) ensures proper contrast in different theme modes.

packages/vue/src/search/src/pc.vue (1)

46-48: Excellent change for dark theme support.

Replacing the conditional background color with 'inherit' ensures the component adapts properly to both light and dark themes by taking on the parent element's background color.

packages/theme/src/anchor/vars.less (1)

47-47: Good semantic variable change.

Updating from --tv-color-border-disabled to --tv-color-border-divider-short better reflects the purpose of this UI element, maintaining visual consistency in dark themes.

packages/theme/src/calendar-view/vars.less (1)

23-23: Better contrast for dark theme compatibility.

Switching to --tv-color-text-control variable improves the contrast of active radio icons in dark themes, ensuring proper visibility of interactive elements.

packages/theme/src/tabs/vars.less (1)

163-163: Great replacement of hardcoded color with theme variable.

Converting from a hardcoded hex value to the --tv-color-border-active variable enables proper theme adaptation while maintaining backward compatibility with the fallback value.

packages/theme/src/wizard/vars.less (1)

103-103: Improved dark theme compatibility for wizard timeline nodes

The background color variable for wizard timeline nodes has been updated to use a more theme-appropriate variable. This change supports dark themes by using a variable that adapts to the current theme context rather than relying on a background color that might not work well in dark mode.

packages/theme/src/filter-box/vars.less (1)

26-26: Enhanced text contrast for button active states

Using --tv-color-text instead of --tv-color-text-active for active button text ensures consistent text visibility in dark themes. This change improves usability by maintaining appropriate contrast regardless of theme.

packages/theme/src/picker/index.less (4)

37-39: Added hover effect for icons

Adding a hover state for SVG icons improves user feedback and accessibility. This is particularly important in dark themes where visual indicators need to be more pronounced.


78-78: Improved background inheritance for clearicon

Changing from hardcoded white background to inherit allows the component to properly adapt to dark themes. This prevents white backgrounds from appearing in dark mode contexts.


106-106: Fixed input background for theme compatibility

Setting the range input background to inherit ensures it adapts to parent container backgrounds in different themes. This prevents inconsistent appearances when switching between light and dark themes.


132-132: Minor selector formatting adjustment

The space removal between selector parts is a minor formatting change that doesn't affect functionality but maintains code consistency.

examples/sites/demos/pc/app/filter-panel/code-composition-api.vue (2)

51-51: Added Less language support

Switching to Less preprocessor enables more powerful styling capabilities needed for theme implementations, such as nesting, variables, and mixins.


78-83: Enhanced textarea pseudo-elements for theme support

Adding background inheritance to pseudo-elements is crucial for dark theme compatibility. This prevents pseudo-elements from having hardcoded backgrounds that would stand out inappropriately in dark modes.

examples/sites/demos/pc/app/filter-panel/code.vue (2)

60-60: Style language updated for better theming support.

Changing the style language to LESS enables more powerful styling capabilities like nesting, variables, and mixins, which are crucial for maintaining consistent theming across the application.


87-92: Good implementation for pseudo-element background inheritance.

Adding the background: inherit property to the pseudo-elements ensures they adapt to theme changes automatically, which is essential for proper dark theme rendering. Without this, the pseudo-elements might display with incorrect backgrounds when the theme changes.

packages/vue/src/picker/src/pc.vue (1)

53-61: Improved icon rendering for dark theme compatibility.

The refactored structure simplifies the component implementation while improving theme compatibility. Removing the transition and restructuring the conditionally rendered components ensures proper icon visibility in both light and dark themes.

packages/theme/src/filter-box/index.less (2)

37-41: Enhanced disabled state visual feedback.

Adding cursor: not-allowed and ensuring color consistency on hover for disabled elements improves accessibility and user experience. This change is particularly important for dark themes where visual cues need to be more pronounced.


69-72: Added hover effect for better interactive feedback.

The hover effect on title labels provides visual feedback to users, enhancing usability by clearly indicating interactive elements. This is especially important in dark themes where contrast may be different.

packages/theme/src/tabs/index.less (3)

303-303: Added text color variable for theme consistency.

Using the variable var(--tv-Tabs-header-font-normal-text-color) for tab content ensures consistent color theming across the component. This is critical for dark theme support.


456-456: Removed box-shadow for cleaner appearance in dark themes.

Setting box-shadow: none improves visual consistency in dark themes where shadows may appear too harsh or misplaced.


497-497: Changed background to inherit for theme adaptability.

Switching from a hardcoded background color to inherit ensures the component automatically adapts to the parent container's background, which is essential for proper dark theme rendering.

packages/theme/src/steps/index.less (7)

248-249: Changed text color for 'done' and 'doing' icons for better visibility in dark mode.

The color change from white to black improves visibility in dark themes, as these icons would appear against a darker background.


252-253: Updated active icon text color for better contrast.

Similar to the previous change, this improves visibility in dark themes by using a higher contrast color.


269-270: Replaced hardcoded fill with CSS variable.

Good refactoring - replacing the hardcoded currentColor with a theme variable var(--tv-Steps-line-doing-active-icon-color) allows for dynamic color changes based on theme.


289-290: Converted hardcoded color to theme variable.

Using the theme variable for active text color ensures consistent styling throughout the component when switching between light and dark themes.


506-507: Updated icon color to use theme variable.

Consistently using the theme variable here maintains visual coherence across different states of the component.


526-527: Applied theme variable to active icon fill.

This change ensures the active state icon fill color is properly themed, which is crucial for dark mode compatibility.


885-886: Used theme variable for border color.

Replacing hardcoded color with var(--tv-Steps-border-left-color) improves theme consistency and allows proper adaptation in dark mode.

examples/sites/demos/pc/app/icon/list.vue (3)

12-15: Improved HTML structure for class bindings.

The refactored div element consolidates class bindings into a single block, improving code readability while maintaining the same functionality.


115-116: Added color styling for hover state.

Setting a specific text color (#191919) on hover provides better visual feedback for users. This matches the hover behavior with other components.


118-120: Added fill color for SVG on hover.

This change ensures that the icon color changes consistently with the text on hover, creating a cohesive interaction experience.

packages/theme/src/calendar-view/index.less (4)

35-38: Improved code readability with proper spacing.

Added blank line before selector block improves code organization and readability.


47-54: Added hover state styling for radio buttons.

The new hover state with background-color: #ededed provides visual feedback when users interact with radio buttons, improving the UX.


61-71: Enhanced active state styling structure.

Improved code organization with proper spacing and clearer nesting of selectors for the active state styling. This makes the code more maintainable.


80-81: Added spacing for better code structure.

Consistent spacing around selector blocks improves code readability and maintenance.

@zzcr
Copy link
Member

zzcr commented Feb 26, 2025

触发下所有修改组件的E2E测试用例哈

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Trigger E2E test cases for all modified components

@discreted66 discreted66 changed the title feat:The widget supports dark themes. feat:[anchor,calendar-view,filter-panel,loading,date-picker,pop-upload,search,scroll-text,step,tabs,wizard,file-upload, calendar]The widget supports dark themes. Feb 26, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (2)
examples/sites/demos/pc/app/icon/basic-usage.vue (1)

46-48: 💡 Verification agent

🧩 Analysis chain

Consider using theme variables for specific icon colors.

This icon has a hardcoded red fill which won't adapt to dark themes. Consider using a theme variable if this icon should change color based on theme.


🏁 Script executed:

#!/bin/bash
# Check if there are theme variables defined for colored icons
rg -A 1 -B 1 "--tv-color-(red|blue|accent|primary|error|warning|success)" packages/theme/src/

Length of output: 556


Action: Update Icon Fill Color to Use Theme Variables

The icon in examples/sites/demos/pc/app/icon/basic-usage.vue (lines 46-48) currently uses a hardcoded red fill. Since hardcoded colors won’t adapt to dark themes, please consider switching to a theme variable—e.g., using var(--tv-color-red) if your theme defines such variables.

To verify whether theme variables like --tv-color-red (or other equivalents such as --tv-color-blue, --tv-color-accent, etc.) are available in the codebase, please run the following updated search command:

If you find a suitable variable, update the code snippet as follows:

-  font-size: 48px;
-  fill: red;
+  font-size: 48px;
+  fill: var(--tv-color-red);  /* Or the appropriate theme variable */

If no theme variable is available, please consult with the design/system team before hardcoding colors that may not support dark themes.


🏁 Script executed:

[run_scripts]
#!/bin/bash
# Corrected command to search for theme variable definitions in packages/theme/src/
rg -o '\-\-tv-color-(red|blue|accent|primary|error|warning|success)' packages/theme/src/

Length of output: 11712


Replace Hardcoded Color with a Theme Variable

The icon in examples/sites/demos/pc/app/icon/basic-usage.vue (lines 46–48) currently uses a hardcoded red fill, which won't adapt for dark themes. Our search confirms that theme variables such as --tv-color-success and --tv-color-error exist in the codebase; however, there is no predefined --tv-color-red.

  • If the red fill indicates an alert/error state: Consider replacing it with var(--tv-color-error).
  • If a distinct red is required: Collaborate with the design/system team to introduce a new theme variable (e.g., --tv-color-red), then update the icon accordingly.

Example diff adjustment:

-  font-size: 48px;
-  fill: red;
+  font-size: 48px;
+  fill: var(--tv-color-error);  /* Or use/define another appropriate theme variable */
examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (1)

39-40: 💡 Verification agent

❓ Verification inconclusive

Consider using theme variables for specific icon colors.

This icon has a hardcoded blue fill which won't adapt to dark themes. Consider using a theme variable if this icon should change color based on theme.


🏁 Script executed:

#!/bin/bash
# Check if there are existing theme-based implementations of colored icons
rg -A 2 -B 2 "\.icon-\w+\s*\{\s*fill:\s*var\(--tv-color" --type css --type less examples/sites/demos/

Length of output: 103


Action Required: Replace Hardcoded Color with Theme Variable

In the file
examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (lines 39–40), the icon’s fill property is hardcoded to blue:

  fill: blue;
}

This approach won’t adapt when switching to dark themes or other theme variations. To improve theme consistency, consider updating this to use a theme variable. For example, you might change it to something like:

  fill: var(--tv-color, blue);
}

This change would allow the icon to inherit the appropriate color based on the active theme, while still providing a fallback.

🧹 Nitpick comments (1)
examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (1)

42-44: Consider using theme variables for specific icon colors.

This icon has a hardcoded red fill which won't adapt to dark themes. Consider using a theme variable if this icon should change color based on theme.

Consider updating the hardcoded colors to use theme variables like:

.icon-demo .icon-clock-work {
  font-size: 48px;
-  fill: red;
+  fill: var(--tv-color-error, red);
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75ec1d5 and 7ac042b.

📒 Files selected for processing (35)
  • examples/sites/demos/pc/app/filter-panel/code-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/filter-panel/code.vue (2 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon-multicolor/list.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/basic-usage.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/list-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/icon/list.vue (2 hunks)
  • examples/sites/demos/pc/app/icon/show-title-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/icon/show-title.vue (1 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/time-line/set-node-width.vue (1 hunks)
  • examples/sites/src/const.ts (2 hunks)
  • packages/theme/src/anchor/vars.less (1 hunks)
  • packages/theme/src/calendar-view/index.less (3 hunks)
  • packages/theme/src/calendar-view/vars.less (1 hunks)
  • packages/theme/src/filter-box/index.less (2 hunks)
  • packages/theme/src/filter-box/vars.less (1 hunks)
  • packages/theme/src/loading/vars.less (1 hunks)
  • packages/theme/src/picker/index.less (6 hunks)
  • packages/theme/src/picker/vars.less (1 hunks)
  • packages/theme/src/pop-upload/index.less (2 hunks)
  • packages/theme/src/pop-upload/vars.less (1 hunks)
  • packages/theme/src/scroll-text/vars.less (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/search/vars.less (1 hunks)
  • packages/theme/src/steps/index.less (6 hunks)
  • packages/theme/src/steps/vars.less (1 hunks)
  • packages/theme/src/tabs/index.less (3 hunks)
  • packages/theme/src/tabs/vars.less (1 hunks)
  • packages/theme/src/upload-list/index.less (1 hunks)
  • packages/theme/src/wizard/vars.less (1 hunks)
  • packages/vue/src/calendar/src/pc.vue (1 hunks)
  • packages/vue/src/picker/src/pc.vue (1 hunks)
  • packages/vue/src/search/src/pc.vue (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • examples/sites/demos/pc/app/icon/show-title-composition-api.vue
🚧 Files skipped from review as they are similar to previous changes (29)
  • examples/sites/demos/pc/app/icon-multicolor/list-composition-api.vue
  • packages/theme/src/search/index.less
  • packages/theme/src/pop-upload/vars.less
  • packages/theme/src/upload-list/index.less
  • examples/sites/demos/pc/app/icon-multicolor/list.vue
  • packages/vue/src/search/src/pc.vue
  • packages/vue/src/picker/src/pc.vue
  • packages/vue/src/calendar/src/pc.vue
  • packages/theme/src/scroll-text/vars.less
  • packages/theme/src/loading/vars.less
  • packages/theme/src/tabs/vars.less
  • examples/sites/demos/pc/app/time-line/set-node-width-composition-api.vue
  • packages/theme/src/pop-upload/index.less
  • packages/theme/src/steps/vars.less
  • packages/theme/src/anchor/vars.less
  • packages/theme/src/wizard/vars.less
  • examples/sites/demos/pc/app/filter-panel/code.vue
  • examples/sites/demos/pc/app/time-line/set-node-width.vue
  • examples/sites/demos/pc/app/filter-panel/code-composition-api.vue
  • examples/sites/demos/pc/app/icon/list.vue
  • packages/theme/src/picker/index.less
  • packages/theme/src/tabs/index.less
  • examples/sites/demos/pc/app/icon/list-composition-api.vue
  • packages/theme/src/filter-box/index.less
  • packages/theme/src/search/vars.less
  • packages/theme/src/filter-box/vars.less
  • packages/theme/src/calendar-view/index.less
  • packages/theme/src/steps/index.less
  • packages/theme/src/calendar-view/vars.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (6)
examples/sites/src/const.ts (1)

1-1:

✅ Verification successful

Verify theme implementation approach has changed.

The changes remove the tinyDarkTheme import and comment out its mapping in themeToolValuesMap, which seems counterintuitive for a PR adding dark theme support. This suggests a shift in implementation strategy - likely moving from a separate theme object to using CSS variables for more dynamic theming.

Ensure this change is intentional and that dark theme functionality is properly implemented via the new approach (CSS variables in Less files) as mentioned in the PR description.

Also applies to: 28-29


🏁 Script executed:

#!/bin/bash
# Check how dark theme is being implemented in the codebase

# Look for CSS variables related to dark theme
echo "Searching for dark theme related CSS variables:"
rg -t less "dark|theme|mode" --glob "*.less" | head -n 20

# Check for theme switching logic
echo -e "\nChecking for theme switching mechanisms:"
rg "theme|mode|dark" --glob "*.{vue,ts,js}" -A 3 -B 3 | grep -v "import" | head -n 20

Length of output: 4051


Dark Theme Implementation Approach is Updated and Intentional

We've verified that the removal of the tinyDarkTheme import and the commented-out mapping in themeToolValuesMap is in line with the new dark theme strategy. Specifically:

  • CSS Variables in Less Files: Searches confirm the presence of dark theme-related styling (e.g., the .dark class in examples/sites/src/assets/custom-block.less and various CSS variable references in package files) indicating that styling is now handled via CSS variables.
  • Theme Switching Logic: Findings in Vue files (e.g., in examples/docs/newsrc/App.vue) suggest that dynamic theming is managed through application state (e.g., modeState.mode), supporting the shift from a separate theme object to a CSS-based approach.

Please ensure that all aspects of dark theme functionality are thoroughly tested under the new implementation.

packages/theme/src/picker/vars.less (1)

37-38: Added CSS variable supports dark theme.

This new CSS variable --tv-Picker-input-clear-icon-bg properly leverages the contextual background color with a fallback to white, which will help maintain proper contrast in dark themes when the clear icon appears.

examples/sites/demos/pc/app/icon/basic-usage.vue (2)

29-30: Icon colors now respect theme variables.

Adding fill and color properties with the CSS variable --tv-color-icon-control ensures icons will adapt properly to dark themes instead of using implicit default colors.


43-44:

❓ Verification inconclusive

Consider using theme variables for specific icon colors.

This icon has a hardcoded blue fill which won't adapt to dark themes. Consider using a theme variable if this icon should change color based on theme.


🏁 Script executed:

#!/bin/bash
# Check if other icons in the codebase use hardcoded colors or theme variables
rg "fill: (blue|red|#[0-9a-fA-F]{3,6})" --type css --type less examples/sites/demos/pc/app/icon/

Length of output: 98


Theme Variables for Icon Color

In examples/sites/demos/pc/app/icon/basic-usage.vue (lines 43–44), the CSS currently hardcodes the fill as blue, which won’t automatically adjust for dark themes. If your design system provides a theme variable for icon colors, consider updating the code. For example, you might change the style to:

  fill: var(--icon-fill, blue);
}

This approach uses the theme variable if available, while defaulting to blue otherwise. It would also be worthwhile to manually verify that similar icons in this directory follow a consistent pattern for theme adaptability.

examples/sites/demos/pc/app/icon/show-title.vue (1)

28-29: Icon colors now respect theme variables.

Adding fill and color properties with the CSS variable --tv-color-icon-control ensures icons will adapt properly to dark themes instead of using implicit default colors. This is consistent with the changes in other icon-related files.

examples/sites/demos/pc/app/icon/basic-usage-composition-api.vue (1)

25-26: Icon colors now respect theme variables.

Adding fill and color properties with the CSS variable --tv-color-icon-control ensures icons will adapt properly to dark themes instead of using implicit default colors.

@discreted66 discreted66 force-pushed the darkTheme1 branch 3 times, most recently from af8d926 to 2ca8618 Compare February 26, 2025 08:52
@zzcr zzcr merged commit 397b0ab into opentiny:dev Feb 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request (功能增强)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants