MCPcopy
hub / github.com/glideapps/glide-data-grid / mergeAndRealizeTheme

Function mergeAndRealizeTheme

packages/core/src/common/styles.ts:155–198  ·  view source on GitHub ↗
(theme: Theme, ...overlays: Partial<Theme | undefined>[])

Source from the content-addressed store, hash-verified

153}
154
155export function mergeAndRealizeTheme(theme: Theme, ...overlays: Partial<Theme | undefined>[]): FullTheme {
156 const merged: any = { ...theme };
157
158 for (const overlay of overlays) {
159 if (overlay !== undefined) {
160 for (const key in overlay) {
161 // eslint-disable-next-line no-prototype-builtins
162 if (overlay.hasOwnProperty(key)) {
163 if (key === "bgCell") {
164 merged[key] = blend(overlay[key] as string, merged[key]);
165 } else {
166 merged[key] = (overlay as any)[key];
167 }
168 }
169 }
170 }
171 }
172
173 if (
174 merged.headerFontFull === undefined ||
175 theme.fontFamily !== merged.fontFamily ||
176 theme.headerFontStyle !== merged.headerFontStyle
177 ) {
178 merged.headerFontFull = `${merged.headerFontStyle} ${merged.fontFamily}`;
179 }
180
181 if (
182 merged.baseFontFull === undefined ||
183 theme.fontFamily !== merged.fontFamily ||
184 theme.baseFontStyle !== merged.baseFontStyle
185 ) {
186 merged.baseFontFull = `${merged.baseFontStyle} ${merged.fontFamily}`;
187 }
188
189 if (
190 merged.markerFontFull === undefined ||
191 theme.fontFamily !== merged.fontFamily ||
192 theme.markerFontStyle !== merged.markerFontStyle
193 ) {
194 merged.markerFontFull = `${merged.markerFontStyle} ${merged.fontFamily}`;
195 }
196
197 return merged;
198}

Callers 15

uri-cell.test.tsFile · 0.85
cells.test.tsxFile · 0.85
data-grid.test.tsxFile · 0.85
SimplenotestFunction · 0.85
SimplenotestFunction · 0.85
SelectedCellnotestFunction · 0.85
SelectedRownotestFunction · 0.85
SelectedColumnnotestFunction · 0.85
drawCellsFunction · 0.85
drawGridHeadersFunction · 0.85

Calls 1

blendFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…