feat(browser): auto-commit con 60 cambios
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,12 @@ import io
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import cairosvg
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
# cairosvg se importa de forma perezosa dentro de los renderers que lo usan
|
||||
# (ver _render_glyph_*). Asi el modulo (y el paquete infra que lo reexporta)
|
||||
# se importa sin requerir cairosvg instalado; solo rasterizar SVGs lo exige.
|
||||
|
||||
|
||||
DEFAULT_SIZES = [16, 24, 32, 48, 64, 128, 256]
|
||||
|
||||
@@ -62,6 +65,8 @@ def _luminance(accent_hex: str) -> float:
|
||||
|
||||
def _render_glyph_colored(svg_path: Path, size: int, fill: str) -> Image.Image:
|
||||
"""Renderiza un SVG Phosphor reemplazando currentColor por `fill`."""
|
||||
import cairosvg
|
||||
|
||||
svg = svg_path.read_text(encoding="utf-8")
|
||||
svg = svg.replace('fill="currentColor"', f'fill="{fill}"')
|
||||
png_bytes = cairosvg.svg2png(
|
||||
@@ -82,6 +87,8 @@ def _render_glyph_white(svg_path: Path, size: int) -> Image.Image:
|
||||
Returns:
|
||||
Imagen RGBA con el glyph en blanco sobre fondo transparente.
|
||||
"""
|
||||
import cairosvg
|
||||
|
||||
svg = svg_path.read_text(encoding="utf-8")
|
||||
# Phosphor usa fill="currentColor" — forzar blanco.
|
||||
svg = svg.replace('fill="currentColor"', 'fill="#ffffff"')
|
||||
|
||||
Reference in New Issue
Block a user