Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修订主题变量 #2911

Open
wants to merge 6 commits into
base: feat_v3.x
Choose a base branch
from
Open

Conversation

xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented Jan 2, 2025

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 新功能

    • 更新了颜色变量系统,引入了更加标准化和一致的命名约定
    • 新增多个颜色变量,如 nutuiColorPrimarynutuiColorSuccessnutuiColorWarning
  • 样式更新

    • 重构了颜色变量定义,提供了更灵活的颜色自定义选项
    • 为各种颜色状态添加了默认回退值
  • 重构

    • 标准化了 CSS 变量的命名规则
    • 优化了颜色管理系统的整体结构

Copy link

coderabbitai bot commented Jan 2, 2025

变更概览

演练

这个拉取请求主要修改了 src/packages/configprovider/types.tssrc/styles/variables.scss 中的颜色变量定义。颜色变量进行了重大重组,引入了新的命名约定,如 nutuiColorPrimary 替代 nutuiBrand6,并添加了多个新的颜色变量,如 nutuiColorSuccessnutuiColorWarning 等。这些变更旨在提高颜色系统的一致性和可维护性。

变更

文件 变更摘要
src/packages/configprovider/types.ts 重新定义 NutCSSVariables 类型,移除旧的颜色变量,添加新的 nutuiColor 前缀变量
src/styles/variables.scss 更新颜色变量引用,使用新的 CSS 变量并提供默认回退值

可能相关的 PR

建议标签

size/M, 3.x

建议审阅者

  • oasis-cloud

诗歌

兔子轻跳,色彩飞舞
变量重组,代码如诗
原色褪去,新彩绽放
设计之美,尽在掌握
🐰✨ 代码,蜕变!


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. (Beta)
  • @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 3.x label Jan 2, 2025
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.97%. Comparing base (93d8a67) to head (455b630).

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #2911   +/-   ##
==========================================
  Coverage      85.97%   85.97%           
==========================================
  Files            277      277           
  Lines          18692    18692           
  Branches        2769     2769           
==========================================
  Hits           16070    16070           
  Misses          2617     2617           
  Partials           5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 (7)
src/packages/configprovider/types.ts (5)

26-29: 细化成功色彩层次
新增更细分的成功色变量(light、background、text),有利于在不同组件场景中丰富样式。可在文档中明确每个变量的典型用法。


40-40: 危险色文本
“nutuiColorDangerText” 传递强烈警示信息,建议在文档或示例中强调其用途。


44-48: 检测拼写错误
“nutuiColorMaskFaultToleran” 可能存在拼写问题,建议改为 “nutuiColorMaskFaultTolerant” 或与设计文档对齐,避免歧义。

- | 'nutuiColorMaskFaultToleran'
+ | 'nutuiColorMaskFaultTolerant'

274-274: 新增灰度层级
“nutuiGray7” 帮助进一步丰富灰度层级,注意与现有灰度变量区分度,避免过多近似值。


854-854: 补充黑色系
“nutuiBlack3” 与 “nutuiBlack7” 搭配使用能完善深色变量体系,但需规划好在不同场景下的对应关系。

src/styles/variables.scss (2)

94-94: 危险色文本
$color-danger-text 便于在成功色或警告色之外呈现更加明显的危险提示。


115-118: 拼写检查
$color-mask-fault-toleran 可能存在拼写或命名不完整问题,建议改为 $color-mask-fault-tolerant 以保证可读性和一致性。

-$color-mask-fault-toleran: var(
-  --nutui-color-mask-fault-toleran,
-  rgba(0, 0, 0, 0.02)
-) !default;
+$color-mask-fault-tolerant: var(
+  --nutui-color-mask-fault-tolerant,
+  rgba(0, 0, 0, 0.02)
+) !default;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 93d8a67 and 455b630.

📒 Files selected for processing (2)
  • src/packages/configprovider/types.ts (7 hunks)
  • src/styles/variables.scss (2 hunks)
🔇 Additional comments (28)
src/packages/configprovider/types.ts (10)

2-8: 确保命名与使用场景一致
这些新增的主题变量与 Primary 色系相关,命名统一且易于理解。请注意检查 “nutuiColorPrimaryDisabledSpecial” 等命名是否与使用场景相符,避免歧义。


23-24: 新增成功色系
新增了 “nutuiColorSuccess” 与 “nutuiColorSuccessPressed”,与其他色系保持统一的前缀和命名方式,便于维护。


30-34: 警告色系命名规范
为警告色添加可按压、禁用、浅色背景等多个状态变量,命名规范清晰,后续若新增更多状态可继续沿用此模式。


35-35: 新增危险色
添加 “nutuiColorDanger” 以统一管理错误或危险提示场景,增强主题一致性。


38-38: 危险色浅色背景
“nutuiColorDangerLight” 便于在浅色背景下呈现轻量级的提示,场景更灵活。


41-42: 扩展背景变量
新增 “nutuiColorBackground” 与 “nutuiColorBackgroundOverlay”,能更好地区分普通背景与叠层背景,提升可维护性。


49-54: 完善文本色系
新增标题、正文、帮助、禁用、深色及链接文本变量,极大增强了主题的灵活度与可扩展性。


186-186: 新增黑色系变量
“nutuiBlack7” 在深色或辅助色场景中更具层次感,建议在设计文档中说明使用范围。

是否需要在文档内提供更多示例以说明此变量的适用场景?


199-199: 新增白色系变量
“nutuiWhite12” 可在暗色背景下提供更高透明度的前景色,建议在深色模式场景中验证可读性。


727-727: 最低灰度变量
“nutuiGray1” 一般代表极浅灰度,可用作背景或分隔线,运用时需评估对比度。

src/styles/variables.scss (18)

3-11: 替换品牌色为标准变量
$color-primary 改为 var(--nutui-color-primary, #ff0f23),与新版命名保持一致,可在后续文档中补充说明该主色的典型用法。


12-15: 添加浅按压状态色
$color-primary-light-pressed 为轻量化按压态或悬浮态提供了额外选择,适用于较柔和的交互效果。


49-53: 更新成功色定制
使用统一布局,如 $color-success$color-success-pressed,在视觉上更具一致性,也更方便后续扩展。


55-58: 成功色浅色背景
$color-success-light 能使成功提示在浅色背景下更柔和,适任提示组件的局部高亮。


59-63: 成功色文本
$color-success-text 帮助快速识别成功状态下的文字信息,可在文档示例中补充用法。


66-70: 警告色命名调整
$color-warning$color-warning-pressed 均使用新命名,更易于记忆维护。


72-75: 浅色警告色补充
$color-warning-light 等变量可让警告信息在多种场景下具备一致的色彩风格,减少手动定义色值。


76-80: 警告色文本变量
$color-warning-text 进一步拆分警告文本色,能有效增强主题细化程度。


83-84: 危险色变量切换
$color-danger$color-danger-pressed 全面转用新命名,利于跨组件统一管理。


89-89: 危险色浅色背景
$color-danger-light 在浅色场景中仍能保持适度可视性,用途更灵活。


90-93: 危险色背景
$color-danger-background 专注深色背景场景,防止警示信息在复杂环境中失焦。


97-97: 全局背景设置
$color-background 改用 #f2f3f5,更适合现代浅色风格,减少阅读疲劳。


99-102: 覆盖层背景
$color-background-overlay 适用于卡片内层或悬浮层背景,进一步强化内容分层。


106-106: 卡片内嵌背景
默认 #f7f8fc 色调更浅,适配浅背景下的信息呈现。


111-111: 全局蒙层
$color-mask 采用透明度为 0.7 的黑色,适合弹窗或交互遮罩,用户注意力集中效果佳。


113-113: 局部蒙层
$color-mask-part 透明度为 0.4,更轻薄,适合局部遮罩或弱化背景时使用。


121-122: 边框色配置
修改 $color-border$color-border-disabled 可统一组件的边框视觉效果,减少维护成本。


125-133: 文本色层级覆盖
标题、正文、帮助、禁用、深色与链接等文本变量更加细化,建议与设计师核对每种文本场景的对应关系,确保全局一致性。

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.

1 participant