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

@githubocto/tailwind-vscode

v1.0.5

Published

Defines Tailwind color classes for VS Code extension colors

Downloads

716

Readme

tailwind-vscode

Are you authoring VS Code extensions with webviews? Step right up! This is a plugin for Tailwind that exposes VS Code's theme colors as Tailwind colors — with all of the variants (bg, text, border, etc…) Now you can author styles for your extension's webviews with Tailwind and use the active VS Code theme colors.

No, this is not a plugin for VS Code! Your absolutely should check out the Tailwind CSS IntelliSense plugin, though. Not gonna lie, it's pretty fantastic.

How do I use it?

Add via your favorite package manager.

$ npm i -D @githubocto/tailwind-vscode
$ # or yarn, I ain't gonna judge
$ yarn add -D @githubocto/tailwind-vscode

Then add the plugin to your tailwind.config.js:

module.exports = {
  /* other config stuff here */
  plugins: [require('@githubocto/tailwind-vscode')],
}

And style components!

<input className='bg-vscode-input-background text-vscode-input-foreground border-vscode-input-border focus:border-vscode-inputOption-activeBorder'/>

Doing a little celebratory dance in your chair is optional but encouraged.

The VS Code theme colors are represented as Tailwind colors under vscode, with hyphens subtituted for periods (foo.barfoo-bar).

How does it work?

Webviews are exposed inside an <iframe>. If you open the webview's developer tools and inspect the <html>, you'll see a style property with a honking large list of CSS custom properties, also known by their rapper name, "variables".

These are injected by VS Code, and contain the style colors defined by the active VS Code theme. When a user changes the theme, the variables change. Voilà, themeability inside webviews.

Only, once you get used to Tailwind-y everything, using those color variables is quite jarring.

This plugin creates a vscode Tailwind color object with definitions for every VS Code theme color.

You could map these variables manually, like so:

module.exports = {
  theme: {
    extend: {
      colors: {
        vscode: {
          'contrastBorder': 'var(--vscode-contrastBorder)',
          'focusBorder': 'var(--vscode-focusBorder)',
          'foreground': 'var(--vscode-foreground)',
          'widget-shadow': 'var(--vscode-widget-shadow)'
          /* … and 500 more */

But this is tedious. Use this plugin and spend your time on loftier pursuits.

License

MIT