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

Button:自定义主题后,danger Button 颜色不正确 #1807

Closed
vczyh opened this issue Dec 21, 2023 · 7 comments
Closed

Button:自定义主题后,danger Button 颜色不正确 #1807

vczyh opened this issue Dec 21, 2023 · 7 comments

Comments

@vczyh
Copy link
Contributor

vczyh commented Dec 21, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

https://github.com/vczyh/taro-nutui-test/tree/loading-button-color

重现步骤

export default function Index() {

  return (
    <ConfigProvider theme={{
      nutuiColorPrimary: '#1677ff',
      nutuiColorPrimaryStop1: '#1677ff',
      nutuiColorPrimaryStop2: '#1677ff',
    }}
    >
      <Button type='danger'>Danger</Button>
    </ConfigProvider>
  )
}

期望的结果是什么?

虽然自定义 brand 颜色为蓝色, danger type button 按钮依然应该是偏红色

实际的结果是什么?

CleanShot 2023-12-21 at 15 59 17@2x

环境信息

No response

其他补充信息

No response

@Me-UserName
Copy link

使用 CSS Variables 进行主题配置 --nutui-brand-8: #1677ff,Primary Button 颜色仍然为京东红,2.3.2版

@oasis-cloud
Copy link
Collaborator

使用 CSS Variables 进行主题配置 --nutui-brand-8: #1677ff,Primary Button 颜色仍然为京东红,2.3.2版

Primary Button 的背景色是采用的渐变模式,可以修改 $color-primary-stop-1和 $color-primary-stop-2。色值之间还不具备联动逻辑。

@oasis-cloud
Copy link
Collaborator

oasis-cloud commented Dec 22, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

vczyh/taro-nutui-test@loading-button-color

重现步骤

export default function Index() {

  return (
    <ConfigProvider theme={{
      nutuiColorPrimary: '#1677ff',
      nutuiColorPrimaryStop1: '#1677ff',
      nutuiColorPrimaryStop2: '#1677ff',
    }}
    >
      <Button type='danger'>Danger</Button>
    </ConfigProvider>
  )
}

期望的结果是什么?

虽然自定义 brand 颜色为蓝色, danger type button 按钮依然应该是偏红色

实际的结果是什么?

CleanShot 2023-12-21 at 15 59 17@2x

环境信息

No response

其他补充信息

No response

你应该在你的主题中修改 $color-danger,或者修改 --nutui-color-danger。像下面这样

  nutuiColorPrimary: '#1677ff',
  nutuiColorDanger: 'red',
  nutuiColorPrimaryStop1: '#1677ff',
  nutuiColorPrimaryStop2: '#1677ff',

@vczyh
Copy link
Contributor Author

vczyh commented Dec 22, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

vczyh/taro-nutui-test@loading-button-color

重现步骤

export default function Index() {

  return (
    <ConfigProvider theme={{
      nutuiColorPrimary: '#1677ff',
      nutuiColorPrimaryStop1: '#1677ff',
      nutuiColorPrimaryStop2: '#1677ff',
    }}
    >
      <Button type='danger'>Danger</Button>
    </ConfigProvider>
  )
}

期望的结果是什么?

虽然自定义 brand 颜色为蓝色, danger type button 按钮依然应该是偏红色

实际的结果是什么?

CleanShot 2023-12-21 at 15 59 17@2x

环境信息

No response

其他补充信息

No response

你应该在你的主题中修改 $color-danger,或者修改 --nutui-color-danger。像下面这样

  nutuiColorPrimary: '#1677ff',
  nutuiColorDanger: 'red',
  nutuiColorPrimaryStop1: '#1677ff',
  nutuiColorPrimaryStop2: '#1677ff',

我有个疑问,为什么 success 等其他按钮有默认颜色,为什么 danger 的默认颜色就是 primary 呢,是不是默认也应该设置为 red 呢。

// 成功
$color-success: var(--nutui-color-success, #00bc14) !default;
$color-success-pressed: var(--nutui-color-success-pressed) !default;
$color-success-disabled: var(--nutui-color-success-disabled, #b2f0ae) !default;
$color-success-light: var(--nutui-color-success-light) !default;
$color-success-background: var(--nutui-color-success-background) !default;

// 警告
$color-warning: var(--nutui-color-warning, rgba(255, 158, 13, 1)) !default;
$color-warning-pressed: var(--nutui-color-warning-pressed) !default;
$color-warning-disabled: var(--nutui-color-warning-disabled, #fdd3b9) !default;
$color-warning-light: var(--nutui-color-warning-light) !default;
$color-warning-background: var(--nutui-color-warning-background) !default;

// 危险
$color-danger: var(--nutui-color-danger, $color-primary) !default;
$color-danger-pressed: var(--nutui-color-danger-pressed) !default;
$color-danger-disabled: var(
  --nutui-color-danger-disabled,
  $color-primary-disabled
) !default;

@xiaoyatong
Copy link
Collaborator

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

vczyh/taro-nutui-test@loading-button-color

重现步骤

export default function Index() {

  return (
    <ConfigProvider theme={{
      nutuiColorPrimary: '#1677ff',
      nutuiColorPrimaryStop1: '#1677ff',
      nutuiColorPrimaryStop2: '#1677ff',
    }}
    >
      <Button type='danger'>Danger</Button>
    </ConfigProvider>
  )
}

期望的结果是什么?

虽然自定义 brand 颜色为蓝色, danger type button 按钮依然应该是偏红色

实际的结果是什么?

CleanShot 2023-12-21 at 15 59 17@2x

环境信息

No response

其他补充信息

No response

你应该在你的主题中修改 $color-danger,或者修改 --nutui-color-danger。像下面这样

  nutuiColorPrimary: '#1677ff',
  nutuiColorDanger: 'red',
  nutuiColorPrimaryStop1: '#1677ff',
  nutuiColorPrimaryStop2: '#1677ff',

我有个疑问,为什么 success 等其他按钮有默认颜色,为什么 danger 的默认颜色就是 primary 呢,是不是默认也应该设置为 red 呢。

// 成功
$color-success: var(--nutui-color-success, #00bc14) !default;
$color-success-pressed: var(--nutui-color-success-pressed) !default;
$color-success-disabled: var(--nutui-color-success-disabled, #b2f0ae) !default;
$color-success-light: var(--nutui-color-success-light) !default;
$color-success-background: var(--nutui-color-success-background) !default;

// 警告
$color-warning: var(--nutui-color-warning, rgba(255, 158, 13, 1)) !default;
$color-warning-pressed: var(--nutui-color-warning-pressed) !default;
$color-warning-disabled: var(--nutui-color-warning-disabled, #fdd3b9) !default;
$color-warning-light: var(--nutui-color-warning-light) !default;
$color-warning-background: var(--nutui-color-warning-background) !default;

// 危险
$color-danger: var(--nutui-color-danger, $color-primary) !default;
$color-danger-pressed: var(--nutui-color-danger-pressed) !default;
$color-danger-disabled: var(
  --nutui-color-danger-disabled,
  $color-primary-disabled
) !default;

我觉得你说的有道理,我们修订一下。

@vczyh
Copy link
Contributor Author

vczyh commented Dec 22, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

vczyh/taro-nutui-test@loading-button-color

重现步骤

export default function Index() {

  return (
    <ConfigProvider theme={{
      nutuiColorPrimary: '#1677ff',
      nutuiColorPrimaryStop1: '#1677ff',
      nutuiColorPrimaryStop2: '#1677ff',
    }}
    >
      <Button type='danger'>Danger</Button>
    </ConfigProvider>
  )
}

期望的结果是什么?

虽然自定义 brand 颜色为蓝色, danger type button 按钮依然应该是偏红色

实际的结果是什么?

CleanShot 2023-12-21 at 15 59 17@2x

环境信息

No response

其他补充信息

No response

你应该在你的主题中修改 $color-danger,或者修改 --nutui-color-danger。像下面这样

  nutuiColorPrimary: '#1677ff',
  nutuiColorDanger: 'red',
  nutuiColorPrimaryStop1: '#1677ff',
  nutuiColorPrimaryStop2: '#1677ff',

我有个疑问,为什么 success 等其他按钮有默认颜色,为什么 danger 的默认颜色就是 primary 呢,是不是默认也应该设置为 red 呢。

// 成功
$color-success: var(--nutui-color-success, #00bc14) !default;
$color-success-pressed: var(--nutui-color-success-pressed) !default;
$color-success-disabled: var(--nutui-color-success-disabled, #b2f0ae) !default;
$color-success-light: var(--nutui-color-success-light) !default;
$color-success-background: var(--nutui-color-success-background) !default;

// 警告
$color-warning: var(--nutui-color-warning, rgba(255, 158, 13, 1)) !default;
$color-warning-pressed: var(--nutui-color-warning-pressed) !default;
$color-warning-disabled: var(--nutui-color-warning-disabled, #fdd3b9) !default;
$color-warning-light: var(--nutui-color-warning-light) !default;
$color-warning-background: var(--nutui-color-warning-background) !default;

// 危险
$color-danger: var(--nutui-color-danger, $color-primary) !default;
$color-danger-pressed: var(--nutui-color-danger-pressed) !default;
$color-danger-disabled: var(
  --nutui-color-danger-disabled,
  $color-primary-disabled
) !default;

我觉得你说的有道理,我们修订一下。

点赞!

@xiaoyatong
Copy link
Collaborator

代码已合并~~

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

No branches or pull requests

4 participants