{"id":15141925,"url":"https://github.com/eddyverbruggen/nativescript-gradient","last_synced_at":"2025-10-23T18:30:57.098Z","repository":{"id":57308543,"uuid":"94936366","full_name":"EddyVerbruggen/nativescript-gradient","owner":"EddyVerbruggen","description":":art: Easily add fancy (or subtle) gradient backgrounds to your views","archived":false,"fork":false,"pushed_at":"2018-06-08T13:20:00.000Z","size":2804,"stargazers_count":54,"open_issues_count":7,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-30T20:30:05.918Z","etag":null,"topics":["gradient","nativescript","nativescript-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EddyVerbruggen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-20T21:25:13.000Z","updated_at":"2024-05-30T15:49:25.000Z","dependencies_parsed_at":"2022-08-29T02:41:41.937Z","dependency_job_id":null,"html_url":"https://github.com/EddyVerbruggen/nativescript-gradient","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-gradient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-gradient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-gradient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-gradient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EddyVerbruggen","download_url":"https://codeload.github.com/EddyVerbruggen/nativescript-gradient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237869287,"owners_count":19379295,"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":["gradient","nativescript","nativescript-plugin"],"created_at":"2024-09-26T09:20:35.675Z","updated_at":"2025-10-23T18:30:55.892Z","avatar_url":"https://github.com/EddyVerbruggen.png","language":"TypeScript","readme":"# NativeScript Gradient 🎨\n\n\u003e PSA: With NativeScript 4.1 this plugin is no longer needed, because linear gradient support is now built-in. Here, have a Tweet about it: https://twitter.com/tjvantoll/status/1004735792474935296. I'm using those in [my plugins demo app](https://github.com/EddyVerbruggen/nativescript-pluginshowcase).\n\n[![Build Status][build-status]][build-url]\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![Twitter Follow][twitter-image]][twitter-url]\n\n[build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-gradient.svg?branch=master\n[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-gradient\n[npm-image]:http://img.shields.io/npm/v/nativescript-gradient.svg\n[npm-url]:https://npmjs.org/package/nativescript-gradient\n[downloads-image]:http://img.shields.io/npm/dm/nativescript-gradient.svg\n[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social\u0026label=Follow%20me\n[twitter-url]:https://twitter.com/eddyverbruggen\n\n\u003cimg src=\"https://github.com/EddyVerbruggen/nativescript-gradient/raw/master/screenshots/ios-full.png?v=2\" height=\"364px\" /\u003e  \u003cimg src=\"https://github.com/EddyVerbruggen/nativescript-gradient/raw/master/screenshots/android-full.png?v=2\" height=\"364px\" /\u003e  \u003cimg src=\"https://github.com/EddyVerbruggen/nativescript-gradient/raw/master/screenshots/ios-partial2.png\" height=\"364px\" /\u003e  \u003cimg src=\"https://github.com/EddyVerbruggen/nativescript-gradient/raw/master/screenshots/android-partial.png?v=2\" height=\"364px\" /\u003e\n\n_Those are screenshots of the [Angular](https://github.com/EddyVerbruggen/nativescript-gradient/tree/master/demo-ng) and [plain XML](https://github.com/EddyVerbruggen/nativescript-gradient/tree/master/demo) demo apps._\n\n## Installation\n```bash\ntns plugin add nativescript-gradient\n```\n\n## Usage\nSince we're subclassing `StackLayout`, you can add `\u003cGradient\u003e` to your view at any place where you'd otherwise use a `StackLayout`.\n\nIn addition to any properties you can already set on a `StackLayout` you should add:\n\n* `colors`: Pass a minimum number of two. Just use the `value` that you would otherwise pass to NativeScript's [`new Color(\"value\")`](https://docs.nativescript.org/api-reference/classes/_color_.color.html). So `red`, `#FF0000`, `rgb(255, 0, 0)`, and even `rgba(255, 0, 0, 0.5)` ([transparency!](https://github.com/EddyVerbruggen/nativescript-gradient/issues/2)) will all work.\n* `direction`: One of \"to bottom\", \"to top\", \"to right\", \"to left\", \"to bottom left\", \"to top left\", \"to bottom right\", \"to top right\".\n\n### Angular\nAdd this to `app.module.ts` so you can use a `Gradient` tag in the view:\n\n```typescript\nimport { registerElement } from \"nativescript-angular\";\nregisterElement(\"Gradient\", () =\u003e require(\"nativescript-gradient\").Gradient);\n```\n\nThese colors are also used in the screenshots above.\n```html\n\u003cGradient direction=\"to right\" colors=\"#FF0077, red, #FF00FF\"\u003e\n  \u003cLabel class=\"p-20 c-white\" horizontalAlignment=\"center\" text=\"My gradients are the best.\" textWrap=\"true\"\u003e\u003c/Label\u003e\n  \u003cLabel class=\"p-10 c-white\" horizontalAlignment=\"center\" text=\"It's true.\" textWrap=\"true\"\u003e\u003c/Label\u003e\n\u003c/Gradient\u003e\n```\n\n### Plain XML\nImport the `Gradient` namespace in the `Page` tag and enjoy the colors!\n```xml\n\u003cPage\n    xmlns=\"http://schemas.nativescript.org/tns.xsd\"\n    xmlns:Gradient=\"nativescript-gradient\" loaded=\"pageLoaded\"\u003e\n\n  \u003cGradient:Gradient direction=\"to right\" colors=\"#FF0077, red, #FF00FF\"\u003e\n    \u003cLabel text=\"Such a fancy gradient :)\" horizontalAlignment=\"center\"/\u003e\n  \u003c/Gradient:Gradient\u003e\n```\n\n## Q \u0026 A\n### Does this plugin use any third party libraries?\nNope, it's as light as a feather!\n\n### What kind of element is the `Gradient` tag?\nIt's a `StackLayout`, so you can use all the regular `StackLayout` properties (like `orientation=\"horizontal\"` and `borderRadius=\"5\"`) - and you can use the `Gradient` tag in any spot where you would otherwise use a `StackLayout`.\n\n### How many `colors` can we pass to the plugin?\nKnock yourself out, but the minimum is two.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-gradient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyverbruggen%2Fnativescript-gradient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-gradient/lists"}