1
- type typeofTypes = 'string' | 'boolean' | 'function' | 'number' | 'object' | 'symbol' | 'undefined' | 'bigint ';
1
+ import { ConfigType , TypeofTypes } from 'src/config.types ';
2
2
3
- export const brackets_colors = [ '#ffd700' , '#da70d6' , '#179fff' ] ;
4
-
5
- export const typeColors = ( type : typeofTypes ) => {
6
- switch ( type ) {
7
- case 'bigint' : return '#b5cea8' ;
8
- case 'number' : return '#b5cea8' ;
9
- case 'object' : return '#569cd6' ;
10
- case 'undefined' : return '#569cd6' ;
11
- case 'boolean' : return '#569cd6' ;
12
- default : return '#ce9178' ;
3
+ const config : ConfigType = {
4
+ colors : {
5
+ main_text : '#ffffff' ,
6
+ background : '#1e1e1e' ,
7
+ header : '#252526' ,
8
+ icon_color : '#ffd700' ,
9
+ indent_lines : '#404040' ,
10
+ line_index : '#6e7681' ,
11
+ keys : '#9cdcfe'
12
+ } ,
13
+ /**
14
+ * Get the color associated with a JavaScript data type.
15
+ *
16
+ * @param {TypeofTypes } type - String-represented JavaScript data type of the current value.
17
+ * @returns {string } Hex color code corresponding to the provided data type.
18
+ */
19
+ typeColor : ( type : TypeofTypes ) : string => {
20
+ switch ( type ) {
21
+ case 'bigint' : return '#b5cea8' ;
22
+ case 'number' : return '#b5cea8' ;
23
+ case 'object' : return '#569cd6' ;
24
+ case 'undefined' : return '#569cd6' ;
25
+ case 'boolean' : return '#569cd6' ;
26
+ default : return '#ce9178' ;
27
+ }
28
+ } ,
29
+ /**
30
+ * Get value quotes if needed.
31
+ *
32
+ * @param {TypeofTypes } type - String-represented JavaScript data type of the current value.
33
+ * @returns {string } Quotes if needed.
34
+ */
35
+ typeQuotes : ( type : TypeofTypes ) : string => {
36
+ const quotesNeeded : TypeofTypes [ ] = [ 'string' , 'symbol' ] ;
37
+ return quotesNeeded . includes ( type ) ? '"' : '' ;
38
+ } ,
39
+ /**
40
+ * Get the color of brackets depending on the deep nesting of the object.
41
+ *
42
+ * @param {number } depth - Current object depth.
43
+ * @returns {string } Hex color code corresponding to the provided depth.
44
+ */
45
+ bracketsColors : ( depth : number ) : string => {
46
+ const brackets_colors = [ '#ffd700' , '#da70d6' , '#179fff' ] ;
47
+ return brackets_colors [ depth % brackets_colors . length ] ;
13
48
}
14
49
}
15
50
16
- export const typeQuotes = ( type : typeofTypes ) => {
17
- const quotesNeeded : typeofTypes [ ] = [ 'string' , 'symbol' ] ;
18
- return quotesNeeded . includes ( type ) ? '"' : '' ;
19
- }
20
-
21
- export const colors = {
22
- main_text : '#ffffff' ,
23
- background : '#1e1e1e' ,
24
- header : '#252526' ,
25
- icon_color : '#ffd700' ,
26
- indent_lines : '#404040' ,
27
- line_index : '#6e7681' ,
28
- keys : '#9cdcfe'
29
- }
51
+ export default config ;
0 commit comments