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

webext-base-css

v2.0.1

Published

Extremely minimal stylesheet/setup for Web Extensions’ options pages (also dark mode)

Downloads

2,553

Readme

webext-base-css

Extremely minimal "native" stylesheet/setup for Web Extensions’ options pages (also dark mode)

It's meant to look as native as possible, invisible. webext-base-css is what browsers should offer by default.

Look at the demo options.html for the suggested markup (it's basic and not really enforced.)

| Demo: Chrome with light theme | Firefox with dark theme | | --- | --- | | white | black |

Install

Download the stylesheet manually or use npm:

npm install webext-base-css

Usage

<link rel="stylesheet" href="webext-base.css">
<link rel="stylesheet" href="your-own-stylesheet-if-necessary.css">

And in your manifest.json:

{
	"options_ui": {
		"page": "options.html",
	}
}

💡 Tip: Also use webext-options-sync to manage and autosave your extension's options.

Usage with a bundler

Depending on how your bundler is configured, you might be able to use one of these to import the module directly from node_modules. If you have issues or have a better solution, please send a PR or open an issue.

<!-- From options.html -->
<link rel="stylesheet" href="./node_modules/webext-base-css/webext-base.css">
// From options.js
import 'webext-base-css';
/* From options.css or .scss */
/* Pick one, it depends on your bundler/config */
@import 'webext-base-css';
@import '~webext-base-css';
@import '~webext-base-css/webext-base.css';
@import 'npm:webext-base-css'; /* Parcel */
@use 'webext-base-css';

Full example

Here's a minimal but full options.html example page:

<!doctype html>
<meta charset="utf-8">
<title>Options</title>
<link rel="stylesheet" href="webext-base.css">
<link rel="stylesheet" href="options.css">
<form>
	<p>
		<label for="name">Name</label><br>
		<input type="text" id="name" name="name" spellcheck="false" autocomplete="off" required/>
	</p>
	<p>
		<label>
			<input type="checkbox" name="logging">
			Show the features enabled on each page in the console
		</label>
	</p>
</form>
<script src="options.js"></script>

Extras

There are some extra classes you can use:

  • .text-monospace ideal for for <input> and <textarea> to have a monospace font

Tips

  • Use the <input size="10"> to define the width of input fields, or else they're now set to 100% by default.
  • Use <link rel="stylesheet" href="chrome://global/skin/in-content/common.css"> if you want to use Firefox's native style, but this means you'll have to handle the inconsistencies between web browsers. This used to be included in webext-base-css v1.

Related