posit-dev / brand-yml

Unified branding with a single yaml file.
https://posit-dev.github.io/brand-yml/
MIT License
1 stars 0 forks source link

feat(logo): Support alt text for logos via `BrandLogoResource` #29

Closed gadenbuie closed 2 days ago

gadenbuie commented 2 days ago

For #19

All paths in logo are now promoted to BrandLogoResource instances. This adds a bit of overhead but makes the Brand instance consistent, where consumers can always look in *.path for the path to a resource which will have an adjacent, optional, .alt property.

This also means that logo: <string> values are promoted to BrandLogoResources, so consumers can expect logo to be either a full BrandLogo or a simple BrandLogoResource:

# Can be written like this
logo: brand-yaml.png

# Parsed into the equivalent of this (alt would be missing)
logo:
  path: brand-yaml.png
  alt: The Brand YAML logo

The examples/brand-logo-full-alt.yml file gives a complete example with all options

logo:
  images:
    mark: 
      path: logos/pandas/pandas_mark.svg
      alt: pandas logo with blue bars and yellow and pink dots
    mark-white: logos/pandas/pandas_mark_white.svg
    secondary: logos/pandas/pandas_secondary.svg
    secondary-white: 
      path: logos/pandas/pandas_secondary_white.svg
      alt: pandas logo with bars and dots over the word "pandas"
    pandas: logos/pandas/pandas.svg
    pandas-white: logos/pandas/pandas_white.svg
  small: mark
  medium:
    light: 
      path: logos/pandas/pandas_secondary.svg
      alt: pandas logo with bars and dots over the word "pandas"
    dark: secondary-white
  large: 
    path: logos/pandas/pandas.svg
    alt: pandas bars and dots to the right of the word "pandas"