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

@dice-roller/vuepress-plugin-dice-roller

v1.3.3

Published

Plugin for VuePress that allows rolling dice

Downloads

10

Readme

RPG Dice Roller Vuepress Plugin

npm (scoped) License

Plugin for VuePress v2 that allows rolling dice. For Vuepress v1, use version v0.1.* of this library.

This library enables adding a dice roller component anywhere within a markdown file, with a simple syntax.

It uses the Dice Roller Vue component, which is built upon the RPG dice roller, and is used in the Dice Roller documentation.

Dice Roller component

Install

Install the plugin:

npm install -D @dice-roller/vuepress-plugin-dice-roller

Then add the plugin to your Vuepress config file:

import { diceRollerPlugin } from '@dice-roller/vuepress-plugin-dice-roller';

export default defineUserConfig({
    ...
    plugins: [
        diceRollerPlugin()
    ]
});

Usage

You can add a die roller anywhere by using the following markdown syntax:

::: roll :::

You can even specify the default notation with:

::: roll {notation} :::

For example:

::: roll 4d6 ::
::: roll (2*6)d10 / (4 - d20) :::

Customise

Styles

You can customise the style of the dice roller component via CSS variables.

These are the variables, and their default values:

:root {
    --dice-roller-text-color: #2c3e50;

    --dice-roller-bg: #eeeeee;
    --dice-roller-border-radius: 0;
    --dice-roller-color: var(--dice-roller-text-color);

    --dice-roller-output-bg: #ffffff;
    --dice-roller-output-border-color: #d4f4c6;
    --dice-roller-output-border-radius: 0;
    --dice-roller-output-color: var(--dice-roller-text-color);
    --dice-roller-output-font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;

    --dice-roller-form-height: 2.75rem;

    --dice-roller-input-bg: #ffffff;
    --dice-roller-input-border: #eaecef;
    --dice-roller-input-border-focus: #d4f4c6;
    --dice-roller-input-color: var(--dice-roller-text-color);

    --dice-roller-button-bg: linear-gradient(to bottom right, #eda18b, #d4f4c6);
    --dice-roller-button-bg-active: linear-gradient(to bottom right, #d4f4c6, #eda18b);
    --dice-roller-button-border-color: rgb(209 213 219);
    --dice-roller-button-color: rgb(75 85 99);

    --dice-roller-error-color: rgb(220 38 38);
}

html.dark {
    --dice-roller-text-color: #adbac7;

    --dice-roller-bg: #2b313a;

    --dice-roller-output-bg: #22272e;

    --dice-roller-input-bg: #22272e;
    --dice-roller-input-border: #3e4c5a;

    --dice-roller-error-color: rgb(254 202 202);
}

Default Vuepress theme

If you're using the default Vuepress theme, we suggest the following overrides, to make it match your theme:

:root {
    --dice-roller-text-color: var(--c-text);

    --dice-roller-bg: var(--c-bg-lighter);
    --dice-roller-border-radius: 0;
    --dice-roller-color: var(--dice-roller-text-color);

    --dice-roller-output-bg: var(--c-bg);
    --dice-roller-output-border-color: var(--c-brand);
    --dice-roller-output-border-radius: 0;
    --dice-roller-output-color: var(--dice-roller-text-color);
    --dice-roller-output-font-family: var(--font-family-code);

    --dice-roller-form-height: 2.75rem;

    --dice-roller-input-bg: var(--c-bg);
    --dice-roller-input-border: var(--c-border);
    --dice-roller-input-border-focus: var(--c-brand);
    --dice-roller-input-color: var(--dice-roller-text-color);

    --dice-roller-button-bg: var(--c-brand);
    --dice-roller-button-bg-active: var(--c-brand-light);
    --dice-roller-button-border-color: var(--c-brand);
    --dice-roller-button-color: var(--c-bg);

    --dice-roller-error-color: var(--c-danger);
}

html.dark {
    --dice-roller-bg: var(--c-bg-light);
}

Custom styles not working

There is an issue with Vuepress, whereby Plugin styling can take precendent over custom styling, causing these CSS overrides to not work.

In this case, you may need to use !important to force your custom styling to take affect.