mirror of https://github.com/iconify/api.git
fix: update code for css, support color
This commit is contained in:
parent
9bb45c8bcf
commit
6e9abebfe5
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": "@iconify/api",
|
||||
"version": "3.0.0-beta.1",
|
||||
"version": "3.0.0-beta.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@iconify/api",
|
||||
"version": "3.0.0-beta.1",
|
||||
"version": "3.0.0-beta.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/formbody": "^7.4.0",
|
||||
"@iconify/tools": "^2.2.0",
|
||||
"@iconify/types": "^2.0.0",
|
||||
"@iconify/utils": "^2.0.9",
|
||||
"@iconify/utils": "^2.0.11",
|
||||
"dotenv": "^16.0.3",
|
||||
"fastify": "^4.11.0"
|
||||
},
|
||||
|
|
@ -246,9 +246,9 @@
|
|||
"integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "2.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.0.9.tgz",
|
||||
"integrity": "sha512-ropNqaeamoxZvXxvaTJXrI0MrqdWdDVIs/mW7/sEQbNi0aXYUGL2iuLs1da3QR163gyG63kiyTsqw2oQYamw3Q==",
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.0.11.tgz",
|
||||
"integrity": "sha512-oEBZkHpkgySHcMZi80ycoJ+ZdLoJhmbN0+gUK8qNPY79ndus8fBHKPyjjwz5kIvr5U9yiym+xBTTnZOB3m5/Pw==",
|
||||
"dependencies": {
|
||||
"@antfu/install-pkg": "^0.1.1",
|
||||
"@antfu/utils": "^0.7.2",
|
||||
|
|
@ -3086,9 +3086,9 @@
|
|||
"integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "2.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.0.9.tgz",
|
||||
"integrity": "sha512-ropNqaeamoxZvXxvaTJXrI0MrqdWdDVIs/mW7/sEQbNi0aXYUGL2iuLs1da3QR163gyG63kiyTsqw2oQYamw3Q==",
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.0.11.tgz",
|
||||
"integrity": "sha512-oEBZkHpkgySHcMZi80ycoJ+ZdLoJhmbN0+gUK8qNPY79ndus8fBHKPyjjwz5kIvr5U9yiym+xBTTnZOB3m5/Pw==",
|
||||
"requires": {
|
||||
"@antfu/install-pkg": "^0.1.1",
|
||||
"@antfu/utils": "^0.7.2",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"author": "Vjacheslav Trushkin",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"version": "3.0.0-beta.2",
|
||||
"version": "3.0.0-beta.3",
|
||||
"bugs": "https://github.com/iconify/api/issues",
|
||||
"homepage": "https://github.com/iconify/api",
|
||||
"repository": {
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"@fastify/formbody": "^7.4.0",
|
||||
"@iconify/tools": "^2.2.0",
|
||||
"@iconify/types": "^2.0.0",
|
||||
"@iconify/utils": "^2.0.9",
|
||||
"@iconify/utils": "^2.0.11",
|
||||
"dotenv": "^16.0.3",
|
||||
"fastify": "^4.11.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -97,12 +97,7 @@ export async function startHTTPServer() {
|
|||
});
|
||||
});
|
||||
|
||||
// Stylesheet: /prefix/style.css, /prefix.css
|
||||
server.get('/:prefix(' + iconNameRoutePartialRegEx + ')/style.css', (req, res) => {
|
||||
runWhenLoaded(() => {
|
||||
generateIconsStyleResponse((req.params as PrefixParams).prefix, req.query, res);
|
||||
});
|
||||
});
|
||||
// Stylesheet: /prefix.css
|
||||
server.get('/:prefix(' + iconNameRoutePartialRegEx + ').css', (req, res) => {
|
||||
runWhenLoaded(() => {
|
||||
generateIconsStyleResponse((req.params as PrefixParams).prefix, req.query, res);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { FastifyReply, FastifyRequest } from 'fastify';
|
||||
import { stringToColor } from '@iconify/utils/lib/colors';
|
||||
import { getIconsCSS } from '@iconify/utils/lib/css/icons';
|
||||
import { getStoredIconsData } from '../../data/icon-set/utils/get-icons';
|
||||
import { iconSets } from '../../data/icon-sets';
|
||||
|
|
@ -53,6 +54,13 @@ export function generateIconsStyleResponse(prefix: string, query: FastifyRequest
|
|||
}
|
||||
}
|
||||
|
||||
// 'color': string
|
||||
// Sets color for monotone images
|
||||
const color = qOptions.color;
|
||||
if (typeof color === 'string' && stringToColor(color)) {
|
||||
options.color = color;
|
||||
}
|
||||
|
||||
// 'mode': string
|
||||
// Forces mode
|
||||
// Alias for 'background': 'bg'
|
||||
|
|
|
|||
Loading…
Reference in New Issue