{"id":23156528,"url":"https://github.com/thecreation/jquery-asgradient","last_synced_at":"2026-03-11T13:17:01.509Z","repository":{"id":19887592,"uuid":"23152094","full_name":"thecreation/jquery-asGradient","owner":"thecreation","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-19T12:02:44.000Z","size":319,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T22:04:57.080Z","etag":null,"topics":["color","gradient-string","jquery-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kopertop/ng2-intercom","license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecreation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-20T14:40:20.000Z","updated_at":"2024-09-01T13:52:34.000Z","dependencies_parsed_at":"2022-08-26T15:41:22.467Z","dependency_job_id":null,"html_url":"https://github.com/thecreation/jquery-asGradient","commit_stats":null,"previous_names":["amazingsurge/jquery-asgradient"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/thecreation/jquery-asGradient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecreation%2Fjquery-asGradient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecreation%2Fjquery-asGradient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecreation%2Fjquery-asGradient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecreation%2Fjquery-asGradient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecreation","download_url":"https://codeload.github.com/thecreation/jquery-asGradient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecreation%2Fjquery-asGradient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262857280,"owners_count":23375492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color","gradient-string","jquery-plugin"],"created_at":"2024-12-17T21:13:54.402Z","updated_at":"2025-12-12T03:02:39.220Z","avatar_url":"https://github.com/thecreation.png","language":"JavaScript","readme":"# [jQuery asGradient](https://github.com/amazingSurge/jquery-asGradient) ![bower][bower-image] [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![prs-welcome]](#contributing)\n\n\u003e A jquery plugin used to manipulate css image gradient. You can add a new color stop. Change the position of color stop. Or remove a color stop. In the end, it can output a formated standard css gradient string. \n\n## Table of contents\n- [Main files](#main-files)\n- [Quick start](#quick-start)\n- [Requirements](#requirements)\n- [Usage](#usage)\n- [Examples](#examples)\n- [Options](#options)\n- [Methods](#methods)\n- [No conflict](#no-conflict)\n- [Browser support](#browser-support)\n- [Contributing](#contributing)\n- [Development](#development)\n- [Changelog](#changelog)\n- [Copyright and license](#copyright-and-license)\n\n## Main files\n```\ndist/\n├── jquery-asGradient.js\n├── jquery-asGradient.es.js\n└── jquery-asGradient.min.js\n```\n\n## Quick start\nSeveral quick start options are available:\n#### Download the latest build\n\n * [Development](https://raw.githubusercontent.com/amazingSurge/jquery-asGradient/master/dist/jquery-asGradient.js) - unminified\n * [Production](https://raw.githubusercontent.com/amazingSurge/jquery-asGradient/master/dist/jquery-asGradient.min.js) - minified\n\n#### Install From Bower\n```sh\nbower install jquery-asGradient --save\n```\n\n#### Install From Npm\n```sh\nnpm install jquery-asGradient --save\n```\n\n#### Install From Yarn\n```sh\nyarn add jquery-asGradient\n```\n\n#### Build From Source\nIf you want build from source:\n\n```sh\ngit clone git@github.com:amazingSurge/jquery-asGradient.git\ncd jquery-asGradient\nnpm install\nnpm install -g gulp-cli babel-cli\ngulp build\n```\n\nDone!\n\n## Requirements\n`jquery-asGradient` requires the latest version of [`jQuery`](https://jquery.com/download/) and [`jQuery-asColor`](https://github.com/amazingSurge/jquery-asColor).\n\n## Usage\n#### Including files:\n\n```html\n\u003cscript src=\"/path/to/jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/path/to/jquery-asColor.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/path/to/jquery-asGradient.js\"\u003e\u003c/script\u003e\n```\n\n#### Initialization\nAll you need to do is call the plugin on the element:\n\n```javascript\nvar gradient = new AsGradient('linear-gradient(to rgba(0, 0, 0, 1), rgba(255, 255, 255, 1))', {\n  cleanPosition: true,\n  color: {\n    format: 'rgba'\n  }\n});\n```\n\n## Examples\nThere are some example usages that you can look at to get started. They can be found in the\n[examples folder](https://github.com/amazingSurge/jquery-asGradient/tree/master/examples).\n\n## Options\n`jquery-asGradient` can accept an options object to alter the way it behaves. You can see the default options by call `$.asGradient.setDefaults()`. The structure of an options object is as follows:\n\n```\n{\n  prefixes: ['-webkit-', '-moz-', '-ms-', '-o-'],\n  forceStandard: true,\n  angleUseKeyword: true,\n  emptyString: '',\n  degradationFormat: false,\n  cleanPosition: true,\n  color: {\n    format: false, // rgb, rgba, hsl, hsla, hex\n    hexUseName: false,\n    reduceAlpha: true,\n    shortenHex: true,\n    zeroAlphaAsTransparent: false,\n    invalidValue: {\n      r: 0,\n      g: 0,\n      b: 0,\n      a: 1\n    }\n  }\n}\n```\n\n## Methods\n\n```javascript\nvar gradient = new AsGradient('linear-gradient(to bottom, yellow, blue)');\n\ngradient.toString();\n```\n\n#### toString()\nGet gradient string.\n```javascript\n// Get standard string.\ngradient.toString();\n\n// Get string by prefix.\ngradient.toString('-moz-');\n```\n\n#### fromString()\nSet values from gradient string.\n```javascript\ngradient.fromString('linear-gradient(to bottom, yellow 0%, blue 100%)');\n```\n\n#### getPrefixedStrings()\nGet prefixed strings array.\n```javascript\ngradient.getPrefixedStrings();\n```\n\n#### val()\nGet or set gradient string.\n```javascript\n// get gradient string\ngradient.val();\n\n// set gradient string\ngradient.val('linear-gradient(to bottom, yellow 0%, blue 100%)');\n```\n\n#### angle()\nGet or set angle.\n```javascript\n// get gradient angle\ngradient.angle();\n\n// set gradient angle\ngradient.angle(60);\n```\n\n#### append(color, position)\nAppend a new color stop.\n```javascript\ngradient.append('#fff', '50%');\n```\n\n#### insert(color, position, index)\nInsert a color stop to index\n```javascript\ngradient.append('#fff', '50%', 1);\n```\n\n#### getCurrent()\nGet current color stop.\n```javascript\nvar stop = gradient.getCurrent();\n```\n\n#### setCurrentById(id)\nSet current color stop by id.\n```javascript\ngradient.setCurrentById(2);\n```\n\n#### getById(id)\nGet color stop by index.\n```javascript\nvar stop = gradient.get(2);\n```\n\n#### removeById(id)\nRemove color stop by id.\n```javascript\ngradient.removeById(2);\n```\n\n#### get(index)\nGet color stop by index.\n```javascript\nvar stop = gradient.get(2);\n```\n\n#### remove(index)\nRemove color stop by index.\n```javascript\ngradient.remove(2);\n```\n\n#### empty()\nEmpty color stops.\n```javascript\ngradient.empty();\n```\n\n#### reset()\nReset gradient.\n```javascript\ngradient.reset();\n```\n\n## No conflict\nIf you have to use other plugin with the same namespace, just call the `$.asGradient.noConflict` method to revert to it.\n\n```html\n\u003cscript src=\"other-plugin.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"jquery-asGradient.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  $.asGradient.noConflict();\n  // Code that uses other plugin's \"$().asGradient\" can follow here.\n\u003c/script\u003e\n```\n\n## Browser support\n\nTested on all major browsers.\n\n| \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/safari/safari_32x32.png\" alt=\"Safari\"\u003e | \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/chrome/chrome_32x32.png\" alt=\"Chrome\"\u003e | \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/firefox/firefox_32x32.png\" alt=\"Firefox\"\u003e | \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/edge/edge_32x32.png\" alt=\"Edge\"\u003e | \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/internet-explorer/internet-explorer_32x32.png\" alt=\"IE\"\u003e | \u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/opera/opera_32x32.png\" alt=\"Opera\"\u003e |\n|:--:|:--:|:--:|:--:|:--:|:--:|\n| Latest ✓ | Latest ✓ | Latest ✓ | Latest ✓ | 9-11 ✓ | Latest ✓ |\n\nAs a jQuery plugin, you also need to see the [jQuery Browser Support](http://jquery.com/browser-support/).\n\n## Contributing\nAnyone and everyone is welcome to contribute. Please take a moment to\nreview the [guidelines for contributing](CONTRIBUTING.md). Make sure you're using the latest version of `jquery-asGradient` before submitting an issue. There are several ways to help out:\n\n* [Bug reports](CONTRIBUTING.md#bug-reports)\n* [Feature requests](CONTRIBUTING.md#feature-requests)\n* [Pull requests](CONTRIBUTING.md#pull-requests)\n* Write test cases for open bug issues\n* Contribute to the documentation\n\n## Development\n`jquery-asGradient` is built modularly and uses Gulp as a build system to build its distributable files. To install the necessary dependencies for the build system, please run:\n\n```sh\nnpm install -g gulp\nnpm install -g babel-cli\nnpm install\n```\n\nThen you can generate new distributable files from the sources, using:\n```\ngulp build\n```\n\nMore gulp tasks can be found [here](CONTRIBUTING.md#available-tasks).\n\n## Changelog\nTo see the list of recent changes, see [Releases section](https://github.com/amazingSurge/jquery-asGradient/releases).\n\n## Copyright and license\nCopyright (C) 2016 amazingSurge.\n\nLicensed under [the LGPL license](LICENSE).\n\n[⬆ back to top](#table-of-contents)\n\n[bower-image]: https://img.shields.io/bower/v/jquery-asGradient.svg?style=flat\n[bower-link]: https://david-dm.org/amazingSurge/jquery-asGradient/dev-status.svg\n[npm-image]: https://badge.fury.io/js/jquery-asGradient.svg?style=flat\n[npm-url]: https://npmjs.org/package/jquery-asGradient\n[license]: https://img.shields.io/npm/l/jquery-asGradient.svg?style=flat\n[prs-welcome]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg\n[daviddm-image]: https://david-dm.org/amazingSurge/jquery-asGradient.svg?style=flat\n[daviddm-url]: https://david-dm.org/amazingSurge/jquery-asGradient\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecreation%2Fjquery-asgradient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecreation%2Fjquery-asgradient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecreation%2Fjquery-asgradient/lists"}