Coder Social home page Coder Social logo

randombits-dev / astro-font-picker Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 1.0 259 KB

Astro Dev Toolbar Integration that lets you try out different fonts on your website

Home Page: https://www.npmjs.com/package/astro-font-picker

License: MIT License

JavaScript 3.31% Astro 43.03% TypeScript 53.67%
astro astro-toolbar font-picker fonts google-fonts toolbar

astro-font-picker's Introduction

Astro Font Picker    NPM Version

Astro Font Picker is a dev toolbar integration that lets you try out different fonts on your site. It uses Google Fonts to load over 1000 open source fonts. Use the up/down keys to quickly cycle through different fonts, or pick one from the list.

astro-font-picker

Installation

Automatic installation:

npx astro add astro-font-picker

Manual installation:

npm install astro-font-picker

Add the following to your astro.config.mjs file:

import astroFontPicker from 'astro-font-picker';

export default {
  integrations: [
    astroFontPicker(),
    // other integrations
  ],
};

Usage

Astro Font Picker will show up as a new icon in the dev toolbar, which is enabled by default in Astro 4.0 and above.

astro-font-picker

Filter the fonts by type (optional), and then choose a font family. The font will be applied to the body element of your site.

If you have font families applied to elements lower than the body element, it will not override those fonts unless you enable the Override All Styles toggle.

Hint: You can use the up/down arrow keys to quickly cycle through the fonts.

Enabled

This toggle controls whether the selected font is applied to the page. It is enabled by default.

Override All Styles

This toggle will override all font-family styles on your site with the selected font. Without this enabled, any font families applied to elements lower than the body element will not be overridden.

The main reason for having the Override All Styles toggle disabled is to maintain the font style of specific elements or sections of your site. This way, when you use the font picker to select a font for other areas, it won't override fonts you have already decided on.

Font CSS Output

This is the stylesheet link and CSS that you can copy and paste into your site to permanently install the font. For example:

In your head element:

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Itim"/>

In your CSS:

h1 {
    font-family: Itim, cursive;
}

View in Google Fonts

This link will open the selected font in Google Fonts.

Settings are stored in session storage

All the settings (enabled, override, font type, and font family) are saved in session storage, so they are not lost when the page refreshes during development.

Other

This project is based off the Fontable library, which is a standalone font picker that can be used on any website.

astro-font-picker's People

Contributors

dependabot[bot] avatar nienow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.