44 *--------------------------------------------------------------------------------------------*/
55
66import Severity from 'vs/base/common/severity' ;
7- import { registerThemingParticipant , ITheme , LIGHT } from 'vs/platform/theme/common/themeService' ;
8- import { Color } from 'vs/base/common/color' ;
9-
10- const errorStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.58318 2.02842C9.96435 2.16331 11.2561 2.77279 12.2383 3.75307C13.3643 4.87923 13.9978 6.40584 14 7.99829C14.0004 9.38617 13.5196 10.7313 12.6396 11.8045C11.7595 12.8778 10.5345 13.6127 9.17333 13.8841C7.81215 14.1556 6.39895 13.9467 5.1745 13.2931C3.95005 12.6394 2.99008 11.5815 2.45814 10.2995C1.92619 9.0175 1.85517 7.59072 2.25717 6.26222C2.65917 4.93373 3.50933 3.7857 4.66282 3.0137C5.8163 2.24171 7.20177 1.89351 8.58318 2.02842ZM8.68038 1.03316C10.292 1.19055 11.7993 1.90184 12.9453 3.04585C14.2587 4.35938 14.9976 6.14013 15 7.99764C15.0005 9.61695 14.4396 11.1864 13.4129 12.4385C12.3861 13.6907 10.9569 14.5482 9.36889 14.8648C7.78084 15.1815 6.13211 14.9378 4.70359 14.1752C3.27506 13.4127 2.1551 12.1784 1.53449 10.6828C0.913887 9.18708 0.831027 7.52251 1.30003 5.97259C1.76903 4.42268 2.76089 3.08331 4.10662 2.18265C5.45236 1.28199 7.06873 0.875761 8.68038 1.03316ZM5.52498 5L8.00004 7.47506L10.4751 5L11.1822 5.70711L8.70714 8.18217L11.1818 10.6569L10.4747 11.364L8.00004 8.88927L5.52535 11.364L4.81824 10.6569L7.29293 8.18217L4.81787 5.70711L5.52498 5Z" fill="` ) ;
11- const errorEnd = encodeURIComponent ( `"/></svg>` ) ;
12- const errorDarkStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.58318 2.02842C9.96435 2.16331 11.2561 2.77279 12.2383 3.75307C13.3643 4.87923 13.9978 6.40584 14 7.99829C14.0004 9.38617 13.5196 10.7313 12.6396 11.8045C11.7595 12.8778 10.5345 13.6127 9.17333 13.8841C7.81215 14.1556 6.39895 13.9467 5.1745 13.2931C3.95005 12.6394 2.99008 11.5815 2.45814 10.2995C1.92619 9.0175 1.85517 7.59072 2.25717 6.26222C2.65917 4.93373 3.50933 3.7857 4.66282 3.0137C5.8163 2.24171 7.20177 1.89351 8.58318 2.02842ZM8.68038 1.03316C10.292 1.19055 11.7993 1.90184 12.9453 3.04585C14.2587 4.35938 14.9976 6.14013 15 7.99764C15.0005 9.61695 14.4396 11.1864 13.4129 12.4385C12.3861 13.6907 10.9569 14.5482 9.36889 14.8648C7.78084 15.1815 6.13211 14.9378 4.70359 14.1752C3.27506 13.4127 2.1551 12.1784 1.53449 10.6828C0.913887 9.18708 0.831027 7.52251 1.30003 5.97259C1.76903 4.42268 2.76089 3.08331 4.10662 2.18265C5.45236 1.28199 7.06873 0.875761 8.68038 1.03316ZM5.52498 5L8.00004 7.47506L10.4751 5L11.1822 5.70711L8.70714 8.18217L11.1818 10.6569L10.4747 11.364L8.00004 8.88927L5.52535 11.364L4.81824 10.6569L7.29293 8.18217L4.81787 5.70711L5.52498 5Z" fill="` ) ;
13- const errorDarkEnd = encodeURIComponent ( `"/></svg>` ) ;
14-
15- const warningStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.12 13.9725L15 12.5L9.37927 2H7.61924L1.9985 12.5L2.87852 13.9725H14.12ZM2.87852 12.9725L8.49925 2.47249L14.12 12.9725H2.87852ZM7.98952 6H8.98802V10H7.98952V6ZM7.98952 11H8.98802V12H7.98952V11Z" fill="` ) ;
16- const warningEnd = encodeURIComponent ( `"/></svg>` ) ;
17- const warningDarkStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.12 13.9725L15 12.5L9.37927 2H7.61924L1.9985 12.5L2.87852 13.9725H14.12ZM2.87852 12.9725L8.49925 2.47249L14.12 12.9725H2.87852ZM7.98952 6H8.98802V10H7.98952V6ZM7.98952 11H8.98802V12H7.98952V11Z" fill="` ) ;
18- const warningDarkEnd = encodeURIComponent ( `"/></svg>` ) ;
19-
20- const infoStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 7.5C3 4.46243 5.46243 2 8.5 2C11.5376 2 14 4.46243 14 7.5C14 10.5376 11.5376 13 8.5 13C5.46243 13 3 10.5376 3 7.5ZM2 7.5C2 3.91015 4.91015 1 8.5 1C12.0899 1 15 3.91015 15 7.5C15 11.0899 12.0899 14 8.5 14C4.91015 14 2 11.0899 2 7.5ZM8 4V5H9V4H8ZM8 6L8 10H9L9 6H8Z" fill="` ) ;
21- const infoEnd = encodeURIComponent ( `"/></svg>` ) ;
22- const infoDarkStart = encodeURIComponent ( `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 7.5C3 4.46243 5.46243 2 8.5 2C11.5376 2 14 4.46243 14 7.5C14 10.5376 11.5376 13 8.5 13C5.46243 13 3 10.5376 3 7.5ZM2 7.5C2 3.91015 4.91015 1 8.5 1C12.0899 1 15 3.91015 15 7.5C15 11.0899 12.0899 14 8.5 14C4.91015 14 2 11.0899 2 7.5ZM8 4V5H9V4H8ZM8 6L8 10H9L9 6H8Z" fill="` ) ;
23- const infoDarkEnd = encodeURIComponent ( `"/></svg>` ) ;
7+ import { registerThemingParticipant } from 'vs/platform/theme/common/themeService' ;
8+ import { problemsErrorIconForeground , problemsInfoIconForeground , problemsWarningIconForeground } from 'vs/platform/theme/common/colorRegistry' ;
249
2510export namespace SeverityIcon {
2611
27- export function getSVGData ( severity : Severity , theme : ITheme ) : string {
28- switch ( severity ) {
29- case Severity . Ignore :
30- const ignoreColor = theme . type === LIGHT ? Color . fromHex ( '#75BEFF' ) : Color . fromHex ( '#007ACC' ) ;
31- return theme . type === LIGHT ? infoStart + encodeURIComponent ( ignoreColor . toString ( ) ) + infoEnd
32- : infoDarkStart + encodeURIComponent ( ignoreColor . toString ( ) ) + infoDarkEnd ;
33- case Severity . Info :
34- const infoColor = theme . type === LIGHT ? Color . fromHex ( '#007ACC' ) : Color . fromHex ( '#75BEFF' ) ;
35- return theme . type === LIGHT ? infoStart + encodeURIComponent ( infoColor . toString ( ) ) + infoEnd
36- : infoDarkStart + encodeURIComponent ( infoColor . toString ( ) ) + infoDarkEnd ;
37- case Severity . Warning :
38- const warningColor = theme . type === LIGHT ? Color . fromHex ( '#DDB100' ) : Color . fromHex ( '#fc0' ) ;
39- return theme . type === LIGHT ? warningStart + encodeURIComponent ( warningColor . toString ( ) ) + warningEnd
40- : warningDarkStart + encodeURIComponent ( warningColor . toString ( ) ) + warningDarkEnd ;
41- case Severity . Error :
42- const errorColor = theme . type === LIGHT ? Color . fromHex ( '#A1260D' ) : Color . fromHex ( '#F48771' ) ;
43- return theme . type === LIGHT ? errorStart + encodeURIComponent ( errorColor . toString ( ) ) + errorEnd
44- : errorDarkStart + encodeURIComponent ( errorColor . toString ( ) ) + errorDarkEnd ;
45- }
46- return '' ;
47- }
48-
4912 export function className ( severity : Severity ) : string {
5013 switch ( severity ) {
5114 case Severity . Ignore :
52- return 'severity-icon severity-ignore ' ;
15+ return 'severity-ignore codicon-info ' ;
5316 case Severity . Info :
54- return 'severity-icon severity -info' ;
17+ return 'codicon -info' ;
5518 case Severity . Warning :
56- return 'severity-icon severity -warning' ;
19+ return 'codicon -warning' ;
5720 case Severity . Error :
58- return 'severity-icon severity -error' ;
21+ return 'codicon -error' ;
5922 }
6023 return '' ;
6124 }
6225}
6326
64- function getCSSRule ( severity : Severity , theme : ITheme ) : string {
65- return `.${ SeverityIcon . className ( severity ) . split ( ' ' ) . join ( '.' ) } { background: url("data:image/svg+xml,${ SeverityIcon . getSVGData ( severity , theme ) } ") center center no-repeat; height: 16px; width: 16px; }` ;
66- }
27+ registerThemingParticipant ( ( thme , collector ) => {
6728
68- registerThemingParticipant ( ( theme , collector ) => {
69- collector . addRule ( getCSSRule ( Severity . Error , theme ) ) ;
70- collector . addRule ( getCSSRule ( Severity . Warning , theme ) ) ;
71- collector . addRule ( getCSSRule ( Severity . Info , theme ) ) ;
72- collector . addRule ( getCSSRule ( Severity . Ignore , theme ) ) ;
73- } ) ;
29+ const errorIconForeground = theme . getColor ( problemsErrorIconForeground ) ;
30+ if ( errorIconForeground ) {
31+ collector . addRule ( `
32+ .monaco-workbench .zone-widget .codicon-error,
33+ .monaco-workbench .markers-panel .marker-icon.codicon-error {
34+ color: ${ errorIconForeground } ;
35+ }
36+ ` ) ;
37+ }
38+
39+ const warningIconForeground = theme . getColor ( problemsWarningIconForeground ) ;
40+ if ( errorIconForeground ) {
41+ collector . addRule ( `
42+ .monaco-workbench .zone-widget .codicon-warning,
43+ .monaco-workbench .markers-panel .marker-icon.codicon-warning {
44+ color: ${ warningIconForeground } ;
45+ }
46+ ` ) ;
47+ }
48+
49+ const infoIconForeground = theme . getColor ( problemsInfoIconForeground ) ;
50+ if ( errorIconForeground ) {
51+ collector . addRule ( `
52+ .monaco-workbench .zone-widget .codicon-info,
53+ .monaco-workbench .markers-panel .marker-icon.codicon-info {
54+ color: ${ infoIconForeground } ;
55+ }
56+ ` ) ;
57+ }
58+ } ) ;
0 commit comments