-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add more attributes to theme set (#5613)
- Loading branch information
Showing
26 changed files
with
463 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.color-picker-overlay { | ||
// 重写颜色选择器样式 | ||
|
||
// 中间颜色滑轨部分 | ||
.flexbox-fix:nth-last-child(3) { | ||
& > :last-child { | ||
display: none; | ||
} | ||
} | ||
|
||
// 中间 rgb 手动输入部分 | ||
.flexbox-fix:nth-last-child(2) { | ||
input { | ||
width: 100% !important; | ||
color: rgba(0, 0, 0, 0.65); | ||
text-align: center; | ||
} | ||
label { | ||
color: rgba(0, 0, 0, 0.45) !important; | ||
} | ||
} | ||
|
||
// 底部推荐色部分 | ||
.flexbox-fix:last-child { | ||
& > div { | ||
width: 18px !important; | ||
height: 18px !important; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { SketchPicker } from 'react-color'; | ||
import { Dropdown } from 'antd'; | ||
import { BUILT_COLORS } from './builtins'; | ||
|
||
export function ColorPicker({ value, onChange, style = {}, className = '' }) { | ||
function onColorChange(newColor) { | ||
const { | ||
rgb: { r, g, b, a }, | ||
} = newColor; | ||
const alpha = | ||
value === undefined || value.toLowerCase() === 'transparent' ? 1 : a; | ||
onChange(`rgba(${r}, ${g}, ${b}, ${alpha})`); | ||
} | ||
|
||
return ( | ||
<Dropdown | ||
overlay={ | ||
<SketchPicker | ||
color={value} | ||
className="config-color-picker-overlay" | ||
onChangeComplete={onColorChange} | ||
presetColors={BUILT_COLORS} | ||
/> | ||
} | ||
trigger={['click', 'hover']} | ||
> | ||
<span | ||
className={className} | ||
style={{ | ||
background: value, | ||
display: 'inline-block', | ||
height: '100%', | ||
cursor: 'pointer', | ||
...style, | ||
}} | ||
></span> | ||
</Dropdown> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.