# computed-style

> Cross-browser currentStyle/getComputedStyle implementation

Latest version **0.3.0** (published 2014-12-17) · 0 weekly downloads

## Install

```sh
npm install computed-style
pnpm add computed-style
yarn add computed-style
bun add computed-style
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2014-12-17 |
| First published | 2013-04-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Todd Wolfson |
| Maintainers | twolfson |
| Keywords | cross-browser, getComputedStyle, currentStyle, css, style |

## Links

- npm: https://www.npmjs.com/package/computed-style
- Repository: https://github.com/twolfson/computedStyle
- Issues: https://github.com/twolfson/computedStyle/issues
- npm.io page: https://npm.io/package/computed-style

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2014-12-17
- 0.2.0 — 2014-12-17
- 0.1.4 — 2014-12-08
- 0.1.3 — 2013-06-19
- 0.1.2 — 2013-06-19
- 0.1.1 — 2013-04-12
- 0.1.0 — 2013-04-12

## README

# computedStyle

Cross-browser currentStyle/getComputedStyle implementation

[![testling-ci badge](https://ci.testling.com/twolfson/computedStyle.png)](https://ci.testling.com/twolfson/computedStyle)

## Getting Started
Download one of the available flavors:

- [Production version][min]
- [Development version][max] - Available via `bower install computedStyle`
- [CommonJS version][commonjs] - Available via `npm install computed-style` and `component install twolfson/computedStyle`
- [AMD version][amd]

[min]: https://raw.github.com/twolfson/computedStyle/master/dist/computedStyle.min.js
[max]: https://raw.github.com/twolfson/computedStyle/master/dist/computedStyle.js
[commonjs]: https://raw.github.com/twolfson/computedStyle/master/dist/computedStyle.commonjs.js
[amd]: https://raw.github.com/twolfson/computedStyle/master/dist/computedStyle.amd.js

In your web page:

```html
<script src="dist/computedStyle.min.js"></script>
<script>
computedStyle(el, 'color'); // Returns color of the element
</script>
```

## Documentation
`computedStyle` is a single purpose function
```js
computedStyle(element, property);
/**
 * Cross-browser getComputedStyle
 * @param {HTMLElement} el Element to get property from
 * @param {String} prop Property to look up (DOM, zIndex, and CSS, z-index, formats accepted)
 * @returns Property from the browser
 *
 * @note These properties can vary from browser to browser.
 * For example, IE6 will return #FF0000 whereas Firefox will return rgb(255, 0, 0)
 * I have chosen to avoid this for this repo as it exits the single purpose
 * and jQuery follows the same approach.
 */
```

## Examples
```js
// Grab the z-index of an element
computedStyle(el, 'z-index');

// Grab the background-color of an element
computedStyle(el, 'background-color');
```

## Donating
Support this project and [others by twolfson][gratipay] via [gratipay][].

[![Support via Gratipay][gratipay-badge]][gratipay]

[gratipay-badge]: https://cdn.rawgit.com/gratipay/gratipay-badge/2.x.x/dist/gratipay.png
[gratipay]: https://www.gratipay.com/twolfson/

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint your code using `npm run lint` and test via `npm test`.

## License
Copyright (c) 2013 Todd Wolfson

Licensed under the MIT license.

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