diff --git a/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.input.less b/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.input.less index 1c8cb4539..9630542d7 100644 --- a/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.input.less +++ b/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.input.less @@ -7,6 +7,6 @@ color: rgba(0, 0, 0, 0.85); background: rgba(0, 0, 0,0.65); background-color: rgba(0,0,0,0.45); - border-color: #fafafa; + border: 1px solid #fafafa; } } diff --git a/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.output.less b/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.output.less index f8870a7d9..41454eb2f 100644 --- a/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.output.less +++ b/packages/codemod/transforms/__testfixtures__/less-to-token/antd-v4-less-to-token.output.less @@ -8,6 +8,6 @@ color: @colorText; background: @colorTextSecondary; background-color: @colorTextTertiary; - border-color: @colorBgLayout; + border: 1px solid @colorBgLayout; } } diff --git a/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.input.less b/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.input.less index 8009590fc..7bcc4e7e5 100644 --- a/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.input.less +++ b/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.input.less @@ -9,6 +9,6 @@ color: rgba(0, 0, 0, 0.85); background: rgba(0, 0, 0,0.65); background-color: rgba(0,0,0,0.45); - border-color: #fafafa; + border: 1px solid #fafafa; } } diff --git a/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.output.less b/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.output.less index f8870a7d9..41454eb2f 100644 --- a/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.output.less +++ b/packages/codemod/transforms/__testfixtures__/less-to-token/obui-less-to-token.output.less @@ -8,6 +8,6 @@ color: @colorText; background: @colorTextSecondary; background-color: @colorTextTertiary; - border-color: @colorBgLayout; + border: 1px solid @colorBgLayout; } } diff --git a/packages/codemod/transforms/utils/token.js b/packages/codemod/transforms/utils/token.js index a1d5f3380..3cfd78996 100644 --- a/packages/codemod/transforms/utils/token.js +++ b/packages/codemod/transforms/utils/token.js @@ -1,26 +1,38 @@ const { toLower } = require('lodash'); const TOKEN_MAP = { - // antd fixed style => antd v5 token - '#f0f2f5': 'colorBgLayout', - '#fafafa': 'colorBgLayout', - '#fff': 'colorBgContainer', - '#ffffff': 'colorBgContainer', + // antd style => token + '#1677ff': 'colorInfo', '#1890ff': 'colorInfo', - '#52c41a': 'colorSuccess', '#73d13d': 'colorSuccess', + '#52c41a': 'colorSuccess', '#faad14': 'colorWarning', '#ff4d4f': 'colorError', '#F5222D': 'colorError', '#F8636B': 'colorError', '#d9d9d9': 'colorBorder', '#bfbfbf': 'colorBorder', + '#f0f2f5': 'colorBgLayout', + '#fafafa': 'colorBgLayout', + '#fff': 'colorBgContainer', + '#ffffff': 'colorBgContainer', 'rgba(0,0,0,0.85)': 'colorText', 'rgba(0,0,0,0.65)': 'colorTextSecondary', 'rgba(0,0,0,0.45)': 'colorTextTertiary', 'rgba(0,0,0,0.25)': 'colorTextQuaternary', 'rgba(0,0,0,0.2)': 'colorFillQuaternary', 'rgba(0,0,0,0.04)': 'colorBgLayout', + // obui style => token + '#006aff': 'colorInfo', + '#0ac185': 'colorSuccess', + '#ffac33': 'colorWarning', + '#ff4b4b': 'colorError', + '#CDD5E4': 'colorBorder', + '#F5F8FE': 'colorBgLayout', + '#132039': 'colorText', + '#364563': 'colorTextSecondary', + '#8592AD': 'colorTextTertiary', + '#F8FAFE': 'colorFillQuaternary', }; function trimAll(str) {