# prism-theme-one-light-dark

> Prism Theme - One Light and One Dark

Latest version **1.0.4** (published 2020-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install prism-theme-one-light-dark
pnpm add prism-theme-one-light-dark
yarn add prism-theme-one-light-dark
bun add prism-theme-one-light-dark
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-10-18 |
| First published | 2020-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ken A. Chan |
| Maintainers | kenchandev |
| Keywords | Prism, theme, one, light, onelight, one-light, dark, onedark, one-dark |

## Links

- npm: https://www.npmjs.com/package/prism-theme-one-light-dark
- Repository: https://github.com/kenchandev/prism-theme-one-light-dark
- Homepage: https://github.com/kenchandev/prism-theme-one-light-dark#readme
- Issues: https://github.com/kenchandev/prism-theme-one-light-dark/issues
- npm.io page: https://npm.io/package/prism-theme-one-light-dark

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-10-18
- 1.0.2 — 2020-08-28
- 1.0.1 — 2020-08-28

## README

# Prism Theme - One Light and One Dark

<p>
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"/></a>
</p>

This package provides light and dark themes based on Atom's [One Light](https://github.com/atom/one-light-syntax) and [One Dark](https://github.com/atom/one-dark-syntax) themes, respectively. 

*Note*: Due to some limitations of Prism's syntax highlighting, there will be slight differences in syntax highlighting between these themes and the originals provided by Atom.

## Installation

```bash
$ npm install --save prism-theme-one-light-dark
```

If the web application uses the Webpack loaders [`style-loader`](https://webpack.js.org/loaders/style-loader/) and [`css-loader`](https://webpack.js.org/loaders/css-loader/), then the themes can be imported like a module.

Import One Dark theme.

```js
import 'prism-theme-one-light-dark/prism-onedark.css';
```

Import One Light theme.

```js
import 'prism-theme-one-light-dark/prism-onelight.css';
```

## Toggle Between Themes (Webpack-Based Projects)

If the web application supports toggling between light and dark themes, then to inject the corresponding Prism theme, use [`raw-loader`](https://webpack.js.org/loaders/raw-loader/), a Webpack loader for importing a file as a raw text string.

*Note*: Since Webpack is one of the core software packages that powers Gatsby, Gatsby automatically provides `raw-loader` to developers.

```js
// Assumption: `theme` argument can only be set to "dark" or "light."
function togglePrismTheme(theme) {
  let prismTheme;

  try {
    prismTheme = require(`!raw-loader!prism-theme-one-light-dark/prism-one${theme}.css`); 
  } catch(e) {
    console.error(e);
  }

  return prismTheme;
}
```

## Customization

To customize the themes:

1. Fork this repository [here](https://github.com/kenchandev/prism-theme-one-light-dark/fork).
2. Place the custom SCSS code in `src/overrides.scss`.
3. Execute `npm run build` to generate the customized themes.

## Preview

Below are screenshots of each theme applied to a snippet of TypeScript code.

For additional previews of other code snippets (Markup, SCSS and JavaScript), download and open the demo files in the `demo` folder.

### TypeScript

![One Light Theme - TypeScript Preview](https://www.dl.dropboxusercontent.com/s/hcb77fnxim1th3b/screen%20shot%202020-10-17%20at%2011.12.12%20pm.png)

![One Dark Theme - TypeScript Preview](https://www.dl.dropboxusercontent.com/s/8vbqbskp3sgyu83/Screen%20Shot%202020-08-26%20at%2010.56.12%20PM.png)

### License

MIT

---
_Source: https://npm.io/package/prism-theme-one-light-dark · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
