MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / adjustColorForOffset

Function adjustColorForOffset

crates/explorer/src/index.js:111–117  ·  view source on GitHub ↗
(element, offset)

Source from the content-addressed store, hash-verified

109
110// Adjust the color styles of a DOM element for a given Wasm offset.
111const adjustColorForOffset = (element, offset) => {
112 let backgroundColor = rgbForOffset(offset);
113 element.style.backgroundColor = rgbToCss(backgroundColor);
114 element.classList.add(
115 rgbToLuma(backgroundColor) > 128 ? "dark-text" : "light-text",
116 );
117};
118
119/*** Event Handlers ************************************************************/
120

Callers 2

index.jsFile · 0.85
addCurrentBlockFunction · 0.85

Calls 4

rgbForOffsetFunction · 0.85
rgbToCssFunction · 0.85
rgbToLumaFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected