npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@visual-framework/vf-masthead

v3.0.1

Published

vf-masthead component

Downloads

134

Readme

Masthead component

npm version

The vf-masthead (masthead) is a full-width container that can take a text, theme colour, an image, and create a 'block' for the text to lay atop.

Usage

The vf-masthead component can be used on the home page of group sites to help inform the visitor of the groups name, location, and additional information.

| ✅ Do's | 🚫 Do Not's | | --------------------------------------- | ------------------------------------------ | | Use this on the homepage of group sites | On every subsquent page | | Use the title block with a theme colour | Use a title block, theme colour, and image |

Background Colours

By Default, the vf-masthead is black text on a light grey background except if it is the title block variant where the text will be white on a black background with an overall light grey background.

This can be effected by either having a component specific class that effects the colours.

Theme Variants available are:

  • vf-masthead-theme--primary
  • vf-masthead-theme--secondary
  • vf-masthead-theme--tertiary

There is also a variant that allows for a background image - vf-masthead--has-image as well as a variant that allows for the text to be in a block of white (with the text being black) - vf-masthead--with-title-block.

notes:

If you are overriding the background or foreground (text) colour make sure you are:

  • using a colour from the Visual Framework
  • testing to be sure that the contrast ratio meets accessibility guidelines

Background Image Size

The maximum dimensions for a background image is 1224px wide with a height of 150px. As more and more displays are what we term 'retina' they need to be twice the width and height to look crisp.

Images that are used for mastheads need to have dimensions of 2448px by 300px.

Text Colour

When using a background image we have to determine the best text colour to meet the contrast ratio from our accessibility guidelines.

We do this using JavaScript and the background image filename.

In choosing the image for masthead the image filename needs to have it's most dominate colour added as a hexadecimal code.

masthead-background-image--00EF00.png

To find the dominant colour in the background image you can use a colour picker in graphics software to find the hex code.

This then allows the code to look for this hexidecimal colour code and mathematically works out the correct text colour to use. The CSS custom property --local-theme-fg-color is then applied in the style tag of the component.

<style>
<div
  class="vf-masthead vf-masthead--has-image"
  style="background-image: var(--vf-masthead__bg-image);
         --local-theme-fg-color:#FFFFFF;"
  data-vf-js-masthead
>
</style>

If JavaScript is disabled, or if it doesn't load with the page. The masthead will default to the background colour.


Browser Support

CSS Custom Properties do not work in older versions of Internet Explorer. We provide a default look for the masthead for these browser which is a white foreground colour (for text) on a green background.

However, this can be overriden if needed using the Sass variables.

Install

This component is distributed with npm. After installing npm, you can install the vf-masthead with this command.

$ yarn add --dev @visual-framework/vf-masthead

Sass/CSS

The source files included are written in Sass(scss). You can point your Sass include-path at your node_modules directory and import it like this.

@import "@visual-framework/vf-masthead/index.scss";

Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter

Help