Skip to content

0.1.0

Latest

Choose a tag to compare

@AliOsm AliOsm released this 07 Jul 14:23

Added

  • Initial release.
  • Mountable Rails engine that tints an application's favicon a distinct color per environment at runtime, leaving production untouched.
  • Environment resolution mirroring env.style: config.environmentENV["ENV_STYLE_ENV"]Rails.env, with per-environment colors and a default_color for unknown non-production environments.
  • Source resolution with zero-config auto-discovery (public/icon.svgpublic/icon.pngpublic/favicon.svgpublic/favicon.ico, SVG preferred), an explicit config.source override (contained within Rails.root), and per-environment source hashes. The served Content-Type reflects the source's true media type, sniffed from its magic bytes.
  • SVG tinting with no image library: a fill/stroke/currentColor swap for monochrome marks and a luminance-preserving <feColorMatrix> duotone for multicolor marks. Color spellings are canonicalized (3-digit hex, common CSS names) when counting distinctness, so a mark written #000/black/#000000 is treated as monochrome.
  • Raster tinting with libvips (ruby-vips): a luminance-preserving recolor with alpha preserved and exclude_colors, plus exclude_tolerance to also preserve the anti-aliased halo of near-matching pixels around an excluded region.
  • Opt-in rasterize_svg to render an SVG source to a tinted PNG at a configurable rasterize_size (default 32 px), staying crisp on hi-dpi tabs.
  • env_style_favicon_tags view helper that emits the favicon <link> for the resolved source, working identically in Hotwire and Inertia apps.
  • On-demand, deterministic tinting keyed on (source digest, environment, color, format, exclude_colors, exclude_tolerance, rasterize_size), served with a strong ETag and Cache-Control: no-cache, must-revalidate, so browsers cache the icon and revalidate with a 304 Not Modified before any image work.
  • Graceful degradation: if tinting ever fails, the favicon route serves the untouched source (non-cacheably) instead of raising, matching the never-break-the-page contract.

Full Changelog: https://github.com/milkstrawai/env_style/commits/0.1.0