Skip to content

Commit 322fa46

Browse files
authored
fix(theme-generator): sync colors in Shadow DOM with user-defined ones (#637)
* fix(theme-generator): sync colors in Shadow DOM with user-defined ones * style(theme-generator): ensure radio text is centered * fix(theme-generator): parse size values for SVG components
1 parent faa4420 commit 322fa46

6 files changed

Lines changed: 30 additions & 18 deletions

File tree

packages/theme-generator/src/common/utils/vars.css

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
--text-placeholder: rgba(0, 0, 0, .4);
5757
--text-disabled: rgba(0, 0, 0, .26);
5858
--text-anti: #fff;
59-
--text-interactive: #0052d9;
60-
--brand-main: #0052d9;
61-
--brand-main-hover: #366ef4;
62-
--brand-main-focus: #d9e1ff;
63-
--brand-main-disabled: #b5c7ff;
59+
--text-interactive: var(--td-brand-color);
60+
--brand-main: var(--td-brand-color);
61+
--brand-main-hover: var(--td-brand-color-hover);
62+
--brand-main-focus: var(--td-brand-color-focus);
63+
--brand-main-disabled: var(--td-brand-color-disabled);
6464
--brand-main-light: rgba(0, 82, 217, .1);
6565
--error-1: #fff0ed;
6666
--error-8: #881f1c;
@@ -132,11 +132,6 @@
132132
--text-placeholder: rgba(255, 255, 255, .35);
133133
--text-disabled: rgba(255, 255, 255, .22);
134134
--text-anti: #fff;
135-
--text-interactive: #4582e6;
136-
--brand-main: #4582e6;
137-
--brand-main-hover: #2667d4;
138-
--brand-main-focus: #173463;
139-
--brand-main-disabled: #143975;
140135
--brand-main-light: rgba(69, 130, 230, .2);
141136
--error-1: #472324;
142137
--error-8: #ec888e;

packages/theme-generator/src/font-panel/components/FontColorAdjust.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ export default {
151151
flex: 1;
152152
text-align: center;
153153
width: 25%;
154-
padding: 4px 0;
154+
padding: 0;
155+
display: flex;
156+
justify-content: center;
157+
align-items: center;
155158
}
156159
157160
/deep/ .t-radio-group__bg-block {

packages/theme-generator/src/font-panel/components/LineHeightAdjust.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,11 @@ export default {
260260
}
261261
/deep/ .t-radio-button {
262262
width: 50%;
263+
padding: 0;
264+
display: flex;
265+
justify-content: center;
266+
align-items: center;
263267
}
264-
265268
/deep/ .t-radio-group__bg-block {
266269
border-radius: 5px;
267270
width: calc(50% - 2px) !important;

packages/theme-generator/src/font-panel/components/SizeAdjust.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ export default {
344344
}
345345
/deep/ .t-radio-button {
346346
width: 50%;
347+
padding: 0;
348+
display: flex;
349+
justify-content: center;
350+
align-items: center;
347351
}
348352
/deep/ .t-radio-group__bg-block {
349353
border-radius: 5px;

packages/theme-generator/src/size-panel/components/SizeAdjust.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
<div :style="{ color: 'var(--text-secondary)' }">{{ token.remark }} : {{ token.value }}</div>
2727
</div>
2828
<div :style="{ display: 'flex', alignItems: 'center' }">
29-
<size-adjust-svg v-if="type === 'comp-size'" :size="token.value" />
30-
<horizontal-padding-adjust-svg v-else-if="type === 'comp-padding-lr'" :size="token.value" />
31-
<vertical-padding-adjust-svg v-else-if="type === 'comp-padding-tb'" :size="token.value" />
32-
<margin-adjust-svg v-else-if="type === 'comp-margin'" :size="token.value" />
33-
<popup-padding-adjust-svg v-else-if="type === 'popup-padding'" :size="token.value" />
29+
<size-adjust-svg v-if="type === 'comp-size'" :size="parseSize(token.value)" />
30+
<horizontal-padding-adjust-svg v-else-if="type === 'comp-padding-lr'" :size="parseSize(token.value)" />
31+
<vertical-padding-adjust-svg v-else-if="type === 'comp-padding-tb'" :size="parseSize(token.value)" />
32+
<margin-adjust-svg v-else-if="type === 'comp-margin'" :size="parseSize(token.value)" />
33+
<popup-padding-adjust-svg v-else-if="type === 'popup-padding'" :size="parseSize(token.value)" />
3434
</div>
3535
</div>
3636
</t-list-item>
@@ -130,6 +130,13 @@ export default {
130130
this.tokenTypeList[idx].value = res;
131131
modifyToken(tokenName, res);
132132
},
133+
parseSize(val) {
134+
if (typeof val === 'string') {
135+
const num = parseFloat(val);
136+
return isNaN(num) ? 0 : num;
137+
}
138+
return val;
139+
},
133140
},
134141
mounted() {
135142
// 将当前的尺寸相关枚举存储

packages/theme-generator/src/styles/tdesign.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)