File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ interface Colors {
56
56
backgroundColor ?: string ;
57
57
}
58
58
59
+ interface Styles extends Colors {
60
+ fontWeight ?: string ;
61
+ opacity ?: string ;
62
+ fontStyle ?: string ;
63
+ visibility ?: string ;
64
+ textDecoration ?: string ;
65
+ }
66
+
67
+
59
68
/**
60
69
* Create the style attribute.
61
70
* @name createStyle
@@ -64,14 +73,38 @@ interface Colors {
64
73
* @return {Object } returns the style object
65
74
*/
66
75
function createStyle ( bundle : AnserJsonEntry ) : Colors {
67
- const style : Colors = { } ;
76
+ const style : Styles = { } ;
68
77
if ( bundle . bg ) {
69
78
style . backgroundColor = `rgb(${ bundle . bg } )` ;
70
79
}
71
80
if ( bundle . fg ) {
72
81
style . color = `rgb(${ bundle . fg } )` ;
73
82
}
74
-
83
+ switch ( bundle . decoration ) {
84
+ case 'bold' :
85
+ style . fontWeight = 'bold' ;
86
+ break ;
87
+ case 'dim' :
88
+ style . opacity = '0.5' ;
89
+ break ;
90
+ case 'italic' :
91
+ style . fontStyle = 'italic' ;
92
+ break ;
93
+ case 'hidden' :
94
+ style . visibility = 'hidden' ;
95
+ break ;
96
+ case 'strikethrough' :
97
+ style . textDecoration = 'line-through' ;
98
+ break ;
99
+ case 'underline' :
100
+ style . textDecoration = 'underline' ;
101
+ break ;
102
+ case 'blink' :
103
+ style . textDecoration = 'blink' ;
104
+ break ;
105
+ default :
106
+ break ;
107
+ }
75
108
return style ;
76
109
}
77
110
You can’t perform that action at this time.
0 commit comments