MCPcopy
hub / github.com/1j01/jspaint / update_css

Function update_css

src/$ToolBox.js:36–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 const $icon = $(E("span")).addClass("tool-icon");
35 $icon.appendTo($b);
36 const update_css = () => {
37 const use_svg = !theme_dev_blob_url && (
38 (
39 get_theme() === "modern.css" || get_theme() === "modern-dark.css" ?
40 // only use raster when screen pixels line up with image pixels exactly
41 (window.devicePixelRatio !== 1) :
42 // with nearest neighbor scaling, favor raster at larger integer sizes as well, for retro look
43 (window.devicePixelRatio >= 3 || (window.devicePixelRatio % 1) !== 0)
44 ) ||
45 $("body").hasClass("enlarge-ui")
46 );
47 $icon.css({
48 display: "block",
49 position: "absolute",
50 left: 4,
51 top: 4,
52 width: 16,
53 height: 16,
54 backgroundImage: theme_dev_blob_url ? `url(${theme_dev_blob_url})` : "",
55 "--icon-index": i.toString(),
56 });
57 $icon.toggleClass("use-svg", use_svg);
58 };
59 update_css();
60 $G.on("theme-load resize", update_css);
61

Callers 1

$ToolBoxFunction · 0.85

Calls 3

get_themeFunction · 0.90
$Function · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected