MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / buildTheme

Function buildTheme

tools/mcsim/assets.js:81–126  ·  view source on GitHub ↗
($, codeFont)

Source from the content-addressed store, hash-verified

79Object.freeze(textures, true)
80
81function buildTheme($, codeFont) {
82 const colors = globalThis.colors = {};
83 const skins = globalThis.skins = {};
84 const styles = globalThis.styles = {};
85
86 colors.backgroundComponent = $.backgroundComponent;
87
88 skins.button = new Skin({ fill:$.button.fill, stroke:$.button.stroke });
89 styles.button = new Style({ font:"semibold", color:$.button.color });
90 styles.serialButton = new Style({ font:"semibold", color:$.button.color , left:15, right:15 });
91 skins.iconButton = new Skin({ fill:$.iconButton.fill });
92 styles.iconButton = new Style({ font:"semibold", color:$.iconButton.color });
93 skins.icons = new Skin({ texture:textures.icons, color:$.iconButton.color, x:2, y:2, width:26, height:26, variants:30 });
94 skins.divider = new Skin({ fill:$.divider.fill });
95 skins.fieldScroller = new Skin({ fill: $.field.fill, stroke:$.field.stroke, borders: { left:1, right:1, bottom:1, top:1 } });
96 skins.field = new Skin({ fill: [$.field.fill, $.fieldSelection.fill], });
97 styles.field = new Style({ color:[$.field.color, $.fieldSelection.color], horizontal:"left", left:5, right:5 });
98 skins.popupButton = new Skin({ fill:$.button.fill, stroke:$.button.stroke });
99 styles.popupButton = new Style({ font:"semibold", color:$.button.color, horizontal:"left" }),
100 skins.popupIcons = new Skin({ texture:textures.popup, color:$.popupMenuItem.color, x:0, y:0, width:20, height:30, variants:20 });
101 skins.popupMenu = new Skin({ fill:$.popupMenu.fill, stroke:$.popupMenu.stroke, left:1, right:1, top:1, bottom:1 });
102 skins.popupMenuItem = new Skin({ fill:$.popupMenuItem.fill });
103 styles.popupMenuItem = new Style({ font: "semibold", color:$.popupMenuItem.color, horizontal:"left" });
104 skins.popupMenuShadow = new Skin({ texture:textures.shadow, x:0, y:0, width:60, height:40, left:20, right:20, top:10, bottom:20 });
105 skins.progressBar = new Skin({ fill:$.progressBar.fill, stroke:$.progressBar.stroke, left:1, right:1, top:1, bottom:1 });
106 skins.scrollbarThumb = new Skin({ fill:$.scrollbarThumb.fill });
107 skins.horizontalScrollbar = new Skin({ fill:$.scrollbar.fill, stroke:$.scrollbar.stroke, top:1 });
108 skins.verticalScrollbar = new Skin({ fill:$.scrollbar.fill, stroke:$.scrollbar.stroke, left:1 });
109 skins.sliderBar = new Skin({ fill:$.sliderBar.fill, stroke:$.sliderBar.stroke });
110 skins.sliderButton = new Skin({ fill:$.sliderButton.fill, stroke:$.sliderButton.stroke });
111 skins.switchBar = new Skin({ fill:$.switchBar.fill, stroke:$.switchBar.stroke });
112 skins.switchButton = new Skin({ fill:$.switchButton.fill, stroke:$.switchButton.stroke });
113
114 skins.paneBody = new Skin({ fill:$.pane.fill });
115 skins.paneBorder = new Skin({ fill:$.header.stroke });
116 skins.paneHeader = new Skin({ fill:$.header.fill });
117 styles.paneHeader = new Style({ font:"semibold", color:$.header.color, horizontal:"left" });
118 styles.paneFooterLeft = new Style({ font:"light", color:$.header.color, horizontal:"left", left:10 });
119 styles.paneFooterRight = new Style({ font:"light", color:$.header.color, horizontal:"right", right:10 });
120
121 styles.controlName = new Style({ color:$.pane.color, horizontal:"left", left:10 });
122 styles.controlValue = new Style({ font:"light", color:$.pane.color, horizontal:"left", left:10 });
123
124 skins.background = new Skin({ fill:$.background.fill });
125 skins.fingerprint = new Skin({ texture:textures.fingerprint, });
126}
127
128export function buildAssets(which) {
129 const theme = themes[which];

Callers 1

buildAssetsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected