{"summary":"리퀴드 글래스 재질을 여섯 겹으로 만드는 방법과 배경의 명암에 따라 틴트와 텍스트 색상을 조정하는 방법을 다룹니다. 이미지나 동영상 위에 놓이는 카드와 플레이어에 적합합니다.","notes":"<p>일반적인 반투명 유리 효과는 반투명 배경과 블러뿐이라, 배경이 복잡하면 글자를 읽기 어렵고 어두운 배경에서는 탁해 보입니다. 리퀴드 글래스는 가장자리 굴절과 배경에 따라 바뀌는 틴트를 더해 두께가 느껴지고 글자도 항상 또렷합니다. 이 재질은 Lumno를 개발하면서 연구한 것으로, 여섯 겹을 쌓아 만듭니다. 아래에서 위로 차례대로 다음과 같습니다.</p>\n        <ol>\n        <li><strong>그림자</strong>: 카드의 입체감을 표현합니다.</li>\n        <li><strong>블러와 밝기 보정</strong>: 배경을 흐리게 하면서 배경의 채도와 밝기를 높여 유리를 더 투명하게 보이게 합니다. 밝은 유리는 채도 180%, 밝기 1.06, 어두운 유리는 채도 160%, 밝기 0.8입니다.</li>\n        <li><strong>가장자리 굴절</strong>: SVG 변위 맵으로 가장자리 둘레의 배경을 안쪽으로 밀고, 가장자리에 가까울수록 많이 밀며 가운데는 평평하게 둡니다. 빨간빛을 파란빛보다 조금 더 굴절시켜 색 분리를 만듭니다. 가장자리 폭 44px, 색 분리 ±15%입니다.</li>\n        <li><strong>틴트</strong>: 반투명한 색 한 겹으로, 불투명도는 배경의 복잡한 정도에 따라 자동으로 조정됩니다. 배경이 복잡할수록 틴트가 진해져 글자를 읽기 쉬워집니다. 밝은 유리는 흰색 6%–22%, 어두운 유리는 16%–38%입니다.</li>\n        <li><strong>테두리 빛</strong>: 왼쪽 위와 오른쪽 아래에 한 줄씩, 그리고 안쪽으로 들여 한 줄을 더해 전체에 두께감을 줍니다.</li>\n        <li><strong>텍스트 색상</strong>: 밝은 유리에서는 곱하기, 어두운 유리에서는 오버레이로 밝게 합성해, 글자에 배경의 색이 조금 묻어나게 합니다.</li>\n        </ol>\n        <p>또한 재질은 배경의 여러 샘플 지점을 읽어 평균 밝기를 계산하고, 0.5보다 낮으면 자동으로 밝은 유리로 바꿉니다. 리퀴드 글래스는 표지, 동영상, 배경화면처럼 명암이나 색 변화가 풍부한 화면에 적합하며, 단색 배경에서는 일반 반투명 색 면과 거의 차이가 없습니다. 글자를 확인할 때는 배경의 가장 밝은 곳과 가장 어두운 곳을 모두 봐야 합니다.</p>\n        <h2>매개변수</h2>\n        <dl class=\"params\">\n        <dt>밝은 유리</dt><dd>틴트 흰색 6%–22%, 블러 2px, 채도 180%, 밝기 1.06</dd>\n        <dt>어두운 유리</dt><dd>틴트 rgb(20 20 24) 16%–38%, 블러 2px, 채도 160%, 밝기 0.8</dd>\n        <dt>굴절</dt><dd>가장자리 폭 44px, 가장자리에서의 이동량 1.1 × 가장자리 폭, 색 분리 ±15%</dd>\n        </dl>\n        <p>필자는 이 재질을 오픈소스 도구 <a href=\"https://www.kubai.design/glasswork/\">Glasswork</a>로 공개했습니다. 착색, 블러, 가장자리 굴절, 가장자리 빛, 글자 색을 패널에서 하나씩 조정하고 여러 배경화면, 사진, 동영상 위에서 확인한 뒤 CSS로 바로 복사할 수 있습니다.</p>\n        <p>함께 제공하는 Prompt는 먼저 제품에서 이미지, 동영상, 복잡한 배경 위에 놓인 카드, 플레이어, 검색창을 나열하고, 어떤 것을 유리로 바꾸고 어떤 것을 그대로 둘지 설명합니다. 그다음 재질을 색상 토큰에 넣고 라이트 모드와 다크 모드에 각각 틴트 농도를 지정하며, 레이아웃은 바꾸지 않습니다.</p>","prompt":"Give the cards and panels in my product a liquid glass material: clear glass that takes its color from the scene behind it, reads as a thick slab at the rim, adapts to what is behind it, and keeps its text readable in light and dark mode. Work inside my existing design system. This is a change of surface, not of layout: keep my markup, spacing, radii, fonts, icons and copy.\n\n0. Start from what exists\n- Find every surface that sits over an image, a wallpaper, video or a busy background: cards, players, search bars, toolbars, menus, popovers, toasts. List them with their component and where they are.\n- Find how the product switches between light and dark mode, and where its color tokens live. The glass goes into those tokens, not into each component.\n- Leave surfaces over a plain background alone; glass over a flat color only looks gray.\n\n1. The material as tokens\nBuild it as one set of variables per state, so a surface opts in by using them. The numbers are a starting point, for a UI at its normal size.\n- Light glass, dark text (the default): tint white at 6–22% (by density, step 4); backdrop filter blur(2px) saturate(180%) brightness(1.06), so the color comes from behind and stays vivid instead of milky.\n  Edge: inset 1.5px 1.5px 1px -1px white 95%, inset -1.5px -1.5px 1px -1px white 55%, inset 0 0 0 0.5px white 30%, 0 0 0 0.5px black 6%, 0 6px 24px black 8%.\n  Inner light, on a layer inside the surface: a radial highlight from the top left (white 30% fading out by 55%), and soft inset glows just inside the rim, brighter at the top and left, a little shade at the bottom.\n- Light mode over a dark area, light text: tint rgb(16 18 22) at 10–30%; filter blur(2px) saturate(170%), then brightness(0.85); edge: a faint inset white line on top and a 0.5px dark outline.\n- Dark mode: tint rgb(20 20 24) at 16–38%; filter blur(2px) saturate(160%) brightness(0.8), which dims like a multiply with black instead of going muddy; the same edge and inner light at about a third of their strength, with a darker outline and shadow.\n- Ink, one color in fixed steps, used for everything drawn on the glass:\n  on light glass black 86% (titles, icons, times, progress), rgb(60 60 67) at 70% (secondary); mix-blend-mode multiply;\n  on dark glass white 94%, rgb(235 235 245) at 64%; mix-blend-mode plus-lighter.\n  Draw icons in the opaque color and fade the whole icon with opacity: a translucent color darkens where a shape's strokes and fills overlap.\n- A highlighted row on light glass is a lighter layer of the glass: white 42% on hover, 76% when selected, with a white stroke. Never a gray wash.\n- Register the numeric and color tokens with @property so a surface glides between states instead of jumping.\n\n2. Apply it in four declarations\nEach surface changes only these, and its markup stays as it is:\n- background: the tint.\n- backdrop-filter: the material's filter, then the rim lens (step 3) last, so the color steps fold into one pass and the bend stays crisp.\n- box-shadow: the edge.\n- color: the ink, with the blend mode on everything drawn inside.\nHover brightens the tint by about 14% instead of lifting a shadow.\n\n3. The rim lens\n- Build a displacement map for each surface: red is the sideways bend, green the vertical one, 128 is none. Only a rim bends; the middle stays flat.\n- The rim is about 44px wide on a card (min(44px, the short side / 3.5), never under 4px). For a thick slab, a point d from the edge looks inward by 1.1 × rim × (1 - d / rim)^2.6: hard at the edge, where the scene folds back on itself, easing to nothing at the rim's inner edge.\n- Draw the map for the same corner the CSS draws. If the surface uses corner-shape: superellipse(), follow that curve, not a circle, or the bend and the rim light miss each other at the corners.\n- Put it in an SVG filter with feImage (the map) and feDisplacementMap (scale = 2 × the largest offset), and add url(#id) at the end of backdrop-filter.\n- Split it into colors: three passes, red 15% further and blue 15% less, each kept to its channel with feColorMatrix and added back with screen blends. Check the corners of wide rims over busy backgrounds; lower the split where it turns into a haze.\n- Only Chromium draws url() in backdrop-filter. Check CSS.supports('backdrop-filter', 'url(#a)') and skip Firefox, which parses it and draws nothing. Everywhere else the CSS-only glass stays.\n- Wait for the map image to decode before pointing a surface at the filter, or it draws without its blur. Give every filter a unique id and its own <svg>. Build maps once per radius and rim width and reuse them; on resize, move the map, don't rebuild it.\n- Skip the lens on surfaces under 32px, and on surfaces with will-change or their own compositing layer (menus, animated panels), where Chrome can draw the map instead of the bent backdrop.\n\n4. Adapt to what is behind\n- For each surface, sample the background under it at a 5 × 3 grid, drop the two darkest and two brightest points, and average. Luminance is (0.299 R + 0.587 G + 0.114 B) / 255; texture is the brightest point minus the darkest.\n- Ink: in light mode, light text when the luminance is under 0.5. Keep the current ink within ±0.05 of the line so a surface never flickers at it. Dark mode is always light text. Neighbouring surfaces in one row share one decision.\n- Density (0 thin, 1 dense) = 0.55 × how close the background is to the ink's own brightness + 0.7 × texture + 0.3 × chroma. It moves the tint between its thin and dense alpha.\n- Saturation kept = 1 - 0.75 × chroma, at least 0.45, so a vivid background doesn't stain the glass.\n- Sample again when the background, the theme or a surface's position changes, and remember the last ink so the next load opens in it.\n- If the background is not an image you can read (live video, cross-origin content), pick the ink from the theme and use the dense tint.\n\n5. Let people set the tint\n- Add one setting for light mode and one for dark that scale the tint, from 0 to 1.5 (1 is the material as designed). Below 1 the brightness lift in the filter thins with it, so at 0 only the blur, the rim and the shadow are left.\n- Each theme keeps its own value; switching themes glides to that theme's value.\n\n6. Keep it accessible\n- Check text contrast on the busiest and the darkest background the product allows, at the default tint; raise density, not the ink's opacity, until it passes.\n- Respect prefers-reduced-transparency and forced colors: fall back to a solid surface in the same tint at full opacity.\n- Keep focus rings, disabled states and error colors as they are; failures keep their red.\n\n7. Deliver\n- First list the surfaces you will change, which get the lens and the color split, and which you leave solid and why.\n- Then add the tokens, the lens helper and the two settings, switch the surfaces over, and list every file you touched.\n- Don't change layout, fonts, radii or copy. If a surface would need a new component to work as glass, stop and ask me first.","skill":"/skills/kubai-liquid-glass/SKILL.md","skillText":"# 液态玻璃材质\n\n《999 个小技巧，让你 Vibe 的产品更有质感》第 010 期 · @kubai087\n\n在用户的项目里按下面的要求改造。要求以用户的口吻写成：文中的 I、me、my 指用户；写着要先问的地方，先停下来问用户再继续。\n\n## 改造要求\n\nGive the cards and panels in my product a liquid glass material: clear glass that takes its color from the scene behind it, reads as a thick slab at the rim, adapts to what is behind it, and keeps its text readable in light and dark mode. Work inside my existing design system. This is a change of surface, not of layout: keep my markup, spacing, radii, fonts, icons and copy.\n\n0. Start from what exists\n- Find every surface that sits over an image, a wallpaper, video or a busy background: cards, players, search bars, toolbars, menus, popovers, toasts. List them with their component and where they are.\n- Find how the product switches between light and dark mode, and where its color tokens live. The glass goes into those tokens, not into each component.\n- Leave surfaces over a plain background alone; glass over a flat color only looks gray.\n\n1. The material as tokens\nBuild it as one set of variables per state, so a surface opts in by using them. The numbers are a starting point, for a UI at its normal size.\n- Light glass, dark text (the default): tint white at 6–22% (by density, step 4); backdrop filter blur(2px) saturate(180%) brightness(1.06), so the color comes from behind and stays vivid instead of milky.\n  Edge: inset 1.5px 1.5px 1px -1px white 95%, inset -1.5px -1.5px 1px -1px white 55%, inset 0 0 0 0.5px white 30%, 0 0 0 0.5px black 6%, 0 6px 24px black 8%.\n  Inner light, on a layer inside the surface: a radial highlight from the top left (white 30% fading out by 55%), and soft inset glows just inside the rim, brighter at the top and left, a little shade at the bottom.\n- Light mode over a dark area, light text: tint rgb(16 18 22) at 10–30%; filter blur(2px) saturate(170%), then brightness(0.85); edge: a faint inset white line on top and a 0.5px dark outline.\n- Dark mode: tint rgb(20 20 24) at 16–38%; filter blur(2px) saturate(160%) brightness(0.8), which dims like a multiply with black instead of going muddy; the same edge and inner light at about a third of their strength, with a darker outline and shadow.\n- Ink, one color in fixed steps, used for everything drawn on the glass:\n  on light glass black 86% (titles, icons, times, progress), rgb(60 60 67) at 70% (secondary); mix-blend-mode multiply;\n  on dark glass white 94%, rgb(235 235 245) at 64%; mix-blend-mode plus-lighter.\n  Draw icons in the opaque color and fade the whole icon with opacity: a translucent color darkens where a shape's strokes and fills overlap.\n- A highlighted row on light glass is a lighter layer of the glass: white 42% on hover, 76% when selected, with a white stroke. Never a gray wash.\n- Register the numeric and color tokens with @property so a surface glides between states instead of jumping.\n\n2. Apply it in four declarations\nEach surface changes only these, and its markup stays as it is:\n- background: the tint.\n- backdrop-filter: the material's filter, then the rim lens (step 3) last, so the color steps fold into one pass and the bend stays crisp.\n- box-shadow: the edge.\n- color: the ink, with the blend mode on everything drawn inside.\nHover brightens the tint by about 14% instead of lifting a shadow.\n\n3. The rim lens\n- Build a displacement map for each surface: red is the sideways bend, green the vertical one, 128 is none. Only a rim bends; the middle stays flat.\n- The rim is about 44px wide on a card (min(44px, the short side / 3.5), never under 4px). For a thick slab, a point d from the edge looks inward by 1.1 × rim × (1 - d / rim)^2.6: hard at the edge, where the scene folds back on itself, easing to nothing at the rim's inner edge.\n- Draw the map for the same corner the CSS draws. If the surface uses corner-shape: superellipse(), follow that curve, not a circle, or the bend and the rim light miss each other at the corners.\n- Put it in an SVG filter with feImage (the map) and feDisplacementMap (scale = 2 × the largest offset), and add url(#id) at the end of backdrop-filter.\n- Split it into colors: three passes, red 15% further and blue 15% less, each kept to its channel with feColorMatrix and added back with screen blends. Check the corners of wide rims over busy backgrounds; lower the split where it turns into a haze.\n- Only Chromium draws url() in backdrop-filter. Check CSS.supports('backdrop-filter', 'url(#a)') and skip Firefox, which parses it and draws nothing. Everywhere else the CSS-only glass stays.\n- Wait for the map image to decode before pointing a surface at the filter, or it draws without its blur. Give every filter a unique id and its own <svg>. Build maps once per radius and rim width and reuse them; on resize, move the map, don't rebuild it.\n- Skip the lens on surfaces under 32px, and on surfaces with will-change or their own compositing layer (menus, animated panels), where Chrome can draw the map instead of the bent backdrop.\n\n4. Adapt to what is behind\n- For each surface, sample the background under it at a 5 × 3 grid, drop the two darkest and two brightest points, and average. Luminance is (0.299 R + 0.587 G + 0.114 B) / 255; texture is the brightest point minus the darkest.\n- Ink: in light mode, light text when the luminance is under 0.5. Keep the current ink within ±0.05 of the line so a surface never flickers at it. Dark mode is always light text. Neighbouring surfaces in one row share one decision.\n- Density (0 thin, 1 dense) = 0.55 × how close the background is to the ink's own brightness + 0.7 × texture + 0.3 × chroma. It moves the tint between its thin and dense alpha.\n- Saturation kept = 1 - 0.75 × chroma, at least 0.45, so a vivid background doesn't stain the glass.\n- Sample again when the background, the theme or a surface's position changes, and remember the last ink so the next load opens in it.\n- If the background is not an image you can read (live video, cross-origin content), pick the ink from the theme and use the dense tint.\n\n5. Let people set the tint\n- Add one setting for light mode and one for dark that scale the tint, from 0 to 1.5 (1 is the material as designed). Below 1 the brightness lift in the filter thins with it, so at 0 only the blur, the rim and the shadow are left.\n- Each theme keeps its own value; switching themes glides to that theme's value.\n\n6. Keep it accessible\n- Check text contrast on the busiest and the darkest background the product allows, at the default tint; raise density, not the ink's opacity, until it passes.\n- Respect prefers-reduced-transparency and forced colors: fall back to a solid surface in the same tint at full opacity.\n- Keep focus rings, disabled states and error colors as they are; failures keep their red.\n\n7. Deliver\n- First list the surfaces you will change, which get the lens and the color split, and which you leave solid and why.\n- Then add the tokens, the lens helper and the two settings, switch the surfaces over, and list every file you touched.\n- Don't change layout, fonts, radii or copy. If a surface would need a new component to work as glass, stop and ask me first.\n"}