MCPcopy Create free account
hub / github.com/adobe/leonardo / updateParams

Function updateParams

docs/ui/src/theme.js:104–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102
103window.updateParams = updateParams;
104function updateParams() {
105 let name = document.getElementById('themeNameInput').value;
106 let ratios = getContrastRatioInputs();
107 let theme = {
108 baseScale: _theme.backgroundColor.name,
109 colorScales: _theme.colors.map((c) => {
110 return {
111 name: c.name,
112 colorKeys: c.colorKeys,
113 colorSpace: c.colorSpace,
114 ratios: ratios,
115 smooth: c.smooth
116 };
117 }),
118 lightness: _theme.lightness,
119 contrast: _theme.contrast,
120 saturation: _theme.saturation,
121 formula: _theme.formula
122 };
123 let url = new URL(window.location);
124 let params = new URLSearchParams(sanitizeQueryString(url.search.slice(1)));
125
126 params.set('name', name); // Theme name
127 params.set('config', JSON.stringify(theme)); // Configurations
128
129 window.history.replaceState({}, '', '?' + params); // update the page's URL.
130}
131
132new ClipboardJS('.copyButton');
133new ClipboardJS('.themeOutputSwatch');

Callers 1

theme.jsFile · 0.85

Calls 2

getContrastRatioInputsFunction · 0.90
sanitizeQueryStringFunction · 0.90

Tested by

no test coverage detected