Skip to content

Commit

Permalink
feat(codemod): TOKEN_MAP add obui style
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Oct 25, 2023
1 parent a249190 commit c5ed68b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
color: @colorText;
background: @colorTextSecondary;
background-color: @colorTextTertiary;
border-color: @colorBgLayout;
border: 1px solid @colorBgLayout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
color: @colorText;
background: @colorTextSecondary;
background-color: @colorTextTertiary;
border-color: @colorBgLayout;
border: 1px solid @colorBgLayout;
}
}
24 changes: 18 additions & 6 deletions packages/codemod/transforms/utils/token.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit c5ed68b

Please sign in to comment.