• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.67
/src/typography/text-color.directive.ts
1
import { Directive, ElementRef, Input, OnInit } from '@angular/core';
2
import { isTextColor, isThemeColor, ThyTextColor, ThyThemeColor } from 'ngx-tethys/core';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4

5
/**
6
 * @name thyTextColor
7
 * @order 20
8
 */
9
@Directive({
1✔
10
    selector: '[thyTextColor]',
11
    exportAs: 'thyTextColor',
×
12
    standalone: true
×
13
})
×
14
export class ThyTextColorDirective implements OnInit {
15
    private color: ThyThemeColor | ThyTextColor | string = '';
16

×
17
    private hostRenderer = useHostRenderer();
×
18

×
19
    /**
20
     * @type ThyThemeColor | ThyTextColor | string
21
     * @description 文本颜色,支持设置主题色和自定义颜色值,主题色为 `default`、`primary`、`success`、`info`、`warning`、`danger`、`light`、`secondary`、`muted`、`desc`、`placeholder`
22
     */
×
23
    @Input() set thyTextColor(value: ThyThemeColor | ThyTextColor | string) {
×
24
        this.clearColor();
25
        this.color = value;
26
        this.setColor();
×
27
    }
28

29
    constructor(private elementRef: ElementRef) {}
30

×
31
    ngOnInit(): void {}
×
32

×
33
    private setColor() {
34
        if (isThemeColor(this.color) || isTextColor(this.color)) {
35
            this.hostRenderer.addClass(`text-${this.color}`);
1✔
36
        } else {
37
            this.hostRenderer.setStyle('color', this.color);
38
        }
1✔
39
    }
40

41
    private clearColor() {
42
        this.hostRenderer.setStyle('color', '');
1✔
43
        if (isThemeColor(this.color) || isTextColor(this.color)) {
44
            this.hostRenderer.removeClass(`text-${this.color}`);
45
        }
46
    }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc