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: `brand_yaml` Python package #12

Closed gadenbuie closed 2 weeks ago

gadenbuie commented 1 month ago

Demo

from brand_yaml import read_brand_yaml

posit = read_brand_yaml("examples/brand-posit.yml")
posit_json = posit.model_dump_json(exclude_none=True, indent=2)
print(posit_json)
{
  "meta": {
    "name": {
      "full": "Posit Software, PBC",
      "short": "Posit"
    },
    "link": {
      "home": "https://posit.co/",
      "mastodon": "https://fosstodon.org/@Posit",
      "linkedin": "https://www.linkedin.com/company/posit-software/",
      "twitter": "https://twitter.com/posit_pbc",
      "guide": "https://positpbc.atlassian.net/wiki/x/AQAgBQ"
    }
  },
  "logo": {
    "small": "posit-icon.png",
    "medium": "posit.png",
    "large": "posit.svg"
  },
  "color": {
    "with_": {
      "blue": "#447099",
      "orange": "#EE6331",
      "gray": "#404041",
      "white": "#FFFFFF",
      "teal": "#419599",
      "green": "#72994E",
      "burgundy": "#9A4665"
    },
    "foreground": "#151515",
    "background": "#FFFFFF",
    "primary": "#447099",
    "secondary": "#707073",
    "tertiary": "#C2C2C4",
    "success": "#72994E",
    "info": "#419599",
    "warning": "#EE6331",
    "danger": "#9A4665",
    "light": "#FFFFFF",
    "dark": "#404041"
  },
  "typography": {
    "fonts": [
      {
        "source": "google",
        "family": "Open Sans",
        "weight": [
          400.0,
          700.0
        ],
        "style": [
          "normal",
          "italic"
        ],
        "display": "auto"
      },
      {
        "source": "google",
        "family": "Fira Code",
        "weight": [
          400.0,
          700.0
        ],
        "style": [
          "normal",
          "italic"
        ],
        "display": "auto"
      },
      {
        "source": "google",
        "family": "Roboto Slab",
        "weight": 600.0,
        "style": "normal",
        "display": "block"
      }
    ],
    "base": {
      "family": "Open Sans",
      "line_height": 1.25,
      "size": "1rem"
    },
    "headings": {
      "family": "Roboto Slab",
      "weight": 600.0,
      "color": "primary"
    },
    "monospace": {
      "family": "Fira Code",
      "size": "0.9em"
    }
  }
}
gadenbuie commented 2 weeks ago

Thanks for the reviews @cpsievert! I'm going to merge this but feel free to ping me here or offline if you have any more comments.