# grapesjs-style-bg

> Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients

Latest version **2.0.2** (published 2023-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install grapesjs-style-bg
pnpm add grapesjs-style-bg
yarn add grapesjs-style-bg
bun add grapesjs-style-bg
```

## 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 | 2.0.2 |
| Published | 2023-06-12 |
| First published | 2020-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 88.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Artur Arseniev |
| Maintainers | artf |
| Keywords | grapesjs, plugin |

## Links

- npm: https://www.npmjs.com/package/grapesjs-style-bg
- Repository: https://github.com/GrapesJS/style-bg
- Homepage: https://github.com/GrapesJS/style-bg#readme
- Issues: https://github.com/GrapesJS/style-bg/issues
- npm.io page: https://npm.io/package/grapesjs-style-bg

## Dependencies (1)

- [grapesjs-style-gradient](https://npm.io/package/grapesjs-style-gradient.md) ^3.0.1

## Recent versions

- 2.0.2 (latest) — 2023-06-12
- 2.0.1 — 2022-12-03
- 1.0.5 — 2021-02-03
- 1.0.3 — 2020-03-30
- 1.0.1 — 2020-03-21

## README

# Grapesjs Style Bg

Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients.

> Requires GrapesJS v0.20.1 or higher

![gradient-prv](https://user-images.githubusercontent.com/11614725/77124488-461ed400-6a43-11ea-9cc5-f80bd3729ef3.jpg)

[DEMO](https://codepen.io/artf/pen/GRGXdYe)

## Summary

* Plugin name: `grapesjs-style-bg`
* This plugin updates the built-in `background` style property.



## Options

| Option | Description | Default |
|-|-|-
| `styleGradientOpts` | Options for the `grapesjs-style-gradient` plugin  | `{}` |
| `propExtender` | Extend single style property definition of the `background` property. | `prop => prop` |



## Download

* CDN
  * `https://unpkg.com/grapesjs-style-bg`
* NPM
  * `npm i grapesjs-style-bg`
* GIT
  * `git clone https://github.com/GrapesJS/style-bg.git`



## Usage

Directly in the browser (remember to include the [Grapick](https://github.com/artf/grapick) CSS)
```html
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/grapick/dist/grapick.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-style-bg.min.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container: '#gjs',
      // ...
      plugins: ['grapesjs-style-bg'],
      pluginsOpts: {
        'grapesjs-style-bg': { /* options */ }
      }
  });
</script>
```

Modern javascript
```js
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-style-bg';
import 'grapesjs/dist/css/grapes.min.css';
import 'grapick/dist/grapick.min.css';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [plugin],
  pluginsOpts: {
    [plugin]: { /* options */ }
  }
  // or
  plugins: [
    editor => plugin(editor, { /* options */ }),
  ],
});
```



## Development

Clone the repository

```sh
$ git clone https://github.com/GrapesJS/style-bg.git
$ cd grapesjs-style-bg
```

Install dependencies

```sh
$ npm i
```

Start the dev server

```sh
$ npm start
```

Build the source

```sh
$ npm run build
```



## License

MIT

---
_Source: https://npm.io/package/grapesjs-style-bg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
