()
| 102 | |
| 103 | window.updateParams = updateParams; |
| 104 | function 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 | |
| 132 | new ClipboardJS('.copyButton'); |
| 133 | new ClipboardJS('.themeOutputSwatch'); |
no test coverage detected