Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@actions/core": "npm:@actions/core@1.10.1",
"@octokit/rest": "npm:@octokit/rest@20.0.2",
"ajv": "npm:ajv@8.12.0",
"type-fest/": "https://esm.sh/v135/type-fest@4.8.1/",
"handlebars": "npm:handlebars@4.7.8",
"less": "npm:less@4.2.0",
"usercss-meta": "npm:usercss-meta@0.12.0"
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ for await (const entry of stylesheets) {
const content = await Deno.readTextFile(entry.path);

// verify the usercss metadata
const { globalVars, isLess } = verifyMetadata(entry, content, repo);
const { globalVars, isLess } = await verifyMetadata(entry, content, repo);
// don't attempt to compile or lint non-less files
if (!isLess) continue;

Expand Down
21 changes: 17 additions & 4 deletions scripts/lint/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// @deno-types="@/types/usercss-meta.d.ts";
import usercssMeta from "usercss-meta";
import { log } from "@/lint/logger.ts";
import * as color from "std/fmt/colors.ts";
import { sprintf } from "std/fmt/printf.ts";
import type { WalkEntry } from "std/fs/walk.ts";
import { relative } from "std/path/mod.ts";

import { REPO_ROOT } from "@/deps.ts";
import { log } from "@/lint/logger.ts";
import { getUserstylesData } from "@/utils.ts";

export const verifyMetadata = (
export const verifyMetadata = async (
entry: WalkEntry,
content: string,
repo: string,
) => {
const assert = assertions(repo);
const assert = await assertions(repo);
const file = relative(REPO_ROOT, entry.path);

const { metadata, errors: parsingErrors } = usercssMeta.parse(content, {
Expand Down Expand Up @@ -67,9 +69,20 @@ export const verifyMetadata = (
};
};

const assertions = (repo: string) => {
const assertions = async (repo: string) => {
const prefix = "https://github.com/catppuccin/userstyles";

const { userstyles } = await getUserstylesData().catch((err) => {
console.error(err);
Deno.exit(1);
});

return {
name: `${
Array.isArray(userstyles[repo].name)
? (userstyles[repo].name as string[]).join("/")
: userstyles[repo].name
} Catppuccin`,
namespace: `github.com/catppuccin/userstyles/styles/${repo}`,
author: "Catppuccin",
license: "MIT",
Expand Down
14 changes: 4 additions & 10 deletions scripts/sync-maintainers/main.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#!/usr/bin/env -S deno run -A
import * as assert from "std/assert/mod.ts";
import * as path from "std/path/mod.ts";
import { Octokit } from "@octokit/rest";

import { REPO_ROOT, userStylesSchema } from "@/deps.ts";
import type { UserStylesSchema } from "@/types/mod.ts";
import { validateYaml } from "@/utils.ts";
import { UserstylesSchema } from "@/types/userstyles.d.ts";
import { getUserstylesData } from "@/utils.ts";

const octokit = new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") });
const team = { org: "catppuccin", team_slug: "userstyles-maintainers" };

const userstylesData = await validateYaml<UserstylesSchema>(
Deno.readTextFileSync(path.join(REPO_ROOT, "scripts/userstyles.yml")),
userStylesSchema,
);
if (userstylesData.userstyles === undefined) {
const userstylesData = await getUserstylesData().catch((err) => {
console.error(err);
Deno.exit(1);
}
});

// lowercase usernames of all the "current-maintainers" in the file
const maintainers = [
Expand Down
25 changes: 25 additions & 0 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import Ajv, { Schema } from "ajv";
import { parse } from "std/yaml/parse.ts";
import { join } from "std/path/join.ts";
import { SetRequired } from "type-fest/source/set-required.d.ts";

import { REPO_ROOT, userStylesSchema } from "@/deps.ts";
import { UserstylesSchema } from "@/types/userstyles.d.ts";

/**
* @param content A string of YAML content
Expand All @@ -20,3 +25,23 @@ export const validateYaml = <T>(
return resolve(data);
});
};

/**
* Utility function that calls {@link validateYaml} on the userstyles.yml file.
* Fails when data.userstyles is undefined.
*/
export const getUserstylesData = (): Promise<Userstyles> => {
return new Promise((resolve, reject) => {
validateYaml<UserstylesSchema>(
Deno.readTextFileSync(join(REPO_ROOT, "scripts/userstyles.yml")),
userStylesSchema,
).then((data) => {
if (data.userstyles === undefined || data.collaborators === undefined) {
return reject("userstyles.yml is missing required fields");
}
return resolve(data as Userstyles);
});
});
};

type Userstyles = SetRequired<UserstylesSchema, "userstyles" | "collaborators">;
2 changes: 1 addition & 1 deletion styles/anilist/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name AniList Catppuccin
@name AniList/AniChart Catppuccin
@namespace github.com/catppuccin/userstyles/styles/anilist
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/anilist
@version 2.1.1
Expand Down
6 changes: 3 additions & 3 deletions styles/chess.com/catppuccin.user.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@name Chess.com Catppuccin
@namespace github.com/catppuccin/userstyles/styles/chess.com
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/chess.com
@version 0.1.2
@version 0.1.3
@updateURL https://github.com/catppuccin/userstyles/raw/main/styles/chess.com/catppuccin.user.css
@supportURL https://github.com/catppuccin/userstyles/issues?q=is%3Aopen+is%3Aissue+label%3Achess.com
@description Soothing pastel theme for Chess.com
Expand Down Expand Up @@ -62,8 +62,8 @@
@crust: @catppuccin[@@lookup][@crust];
@accent-color: @catppuccin[@@lookup][@@accent];

#piece(@name) {
@url: url("https://media.githubusercontent.com/media/catppuccin/userstyles/main/styles/chess.com/assets/@{lookup}/@{name}.png");
#piece(@piece) {
@url: url("https://media.githubusercontent.com/media/catppuccin/userstyles/main/styles/chess.com/assets/@{lookup}/@{piece}.png");
}

@bb: #piece("b/bb") [];
Expand Down
76 changes: 38 additions & 38 deletions styles/github/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* ==UserStyle==
@name Github Catppuccin
@namespace github.com/catppuccin/userstyles/styles/github
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/github
@version 1.3.2
@description Soothing pastel theme for GitHub
@author Catppuccin
@updateURL https://github.com/catppuccin/userstyles/raw/main/styles/github/catppuccin.user.css
@supportURL https://github.com/catppuccin/userstyles/issues?q=is%3Aopen+is%3Aissue+label%3Agithub
@license MIT
@name GitHub Catppuccin
@namespace github.com/catppuccin/userstyles/styles/github
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/github
@version 1.3.3
@description Soothing pastel theme for GitHub
@author Catppuccin
@updateURL https://github.com/catppuccin/userstyles/raw/main/styles/github/catppuccin.user.css
@supportURL https://github.com/catppuccin/userstyles/issues?q=is%3Aopen+is%3Aissue+label%3Agithub
@license MIT

@preprocessor less
@var select lightFlavor "Light Flavor" ["latte:Latte*", "frappe:Frapp茅", "macchiato:Macchiato", "mocha:Mocha"]
Expand Down Expand Up @@ -58,49 +58,49 @@
z-index: 9999;
}

#coloredButton(@name, @color, @flat) {
#coloredButton(@item, @color, @flat) {
& when (@flat) {
--color-btn-@{name}-text: @color;
--color-btn-@{name}-bg: @base;
--color-btn-@{name}-icon: @color;
--color-btn-@{item}-text: @color;
--color-btn-@{item}-bg: @base;
--color-btn-@{item}-icon: @color;

--color-btn-@{name}-hover-text: @base;
--color-btn-@{name}-hover-bg: @color;
--color-btn-@{name}-hover-border: @color;
--color-btn-@{item}-hover-text: @base;
--color-btn-@{item}-hover-bg: @color;
--color-btn-@{item}-hover-border: @color;

--color-btn-@{name}-selected-text: @base;
--color-btn-@{name}-selected-bg: @color;
--color-btn-@{name}-selected-border: @color;
--color-btn-@{item}-selected-text: @base;
--color-btn-@{item}-selected-bg: @color;
--color-btn-@{item}-selected-border: @color;

--color-btn-@{name}-disabled-text: fadeout(@color, 60%);
--color-btn-@{name}-disabled-bg: @mantle;
--color-btn-@{item}-disabled-text: fadeout(@color, 60%);
--color-btn-@{item}-disabled-bg: @mantle;
}

& when not (@flat) {
--color-btn-@{name}-text: @base;
--color-btn-@{name}-bg: @color;
--color-btn-@{name}-icon: @base;
--color-btn-@{item}-text: @base;
--color-btn-@{item}-bg: @color;
--color-btn-@{item}-icon: @base;

--color-btn-@{name}-hover-text: @base;
--color-btn-@{name}-hover-bg: lighten(@color, 10%);
--color-btn-@{name}-hover-border: lighten(@color, 10%);
--color-btn-@{item}-hover-text: @base;
--color-btn-@{item}-hover-bg: lighten(@color, 10%);
--color-btn-@{item}-hover-border: lighten(@color, 10%);

--color-btn-@{name}-selected-text: @base;
--color-btn-@{name}-selected-bg: lighten(@color, 10%);
--color-btn-@{name}-selected-border: lighten(@color, 10%);
--color-btn-@{item}-selected-text: @base;
--color-btn-@{item}-selected-bg: lighten(@color, 10%);
--color-btn-@{item}-selected-border: lighten(@color, 10%);

--color-btn-@{name}-disabled-text: @crust;
--color-btn-@{name}-disabled-bg: fadeout(@color, 60%);
--color-btn-@{item}-disabled-text: @crust;
--color-btn-@{item}-disabled-bg: fadeout(@color, 60%);
}

--color-btn-@{name}-hover-icon: @base;
--color-btn-@{item}-hover-icon: @base;

/* set these to transparent for the looks */
--color-btn-@{name}-border: transparent;
--color-btn-@{name}-shadow: 0 0 transparent;
--color-btn-@{name}-inset-shadow: 0 0 transparent;
--color-btn-@{name}-selected-shadow: 0 0 transparent;
--color-btn-@{name}-disabled-border: transparent;
--color-btn-@{item}-border: transparent;
--color-btn-@{item}-shadow: 0 0 transparent;
--color-btn-@{item}-inset-shadow: 0 0 transparent;
--color-btn-@{item}-selected-shadow: 0 0 transparent;
--color-btn-@{item}-disabled-border: transparent;
}

#catppuccin(@lookup, @accent) {
Expand Down
2 changes: 1 addition & 1 deletion styles/hacker-news/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name HackerNews Catppuccin
@name Hacker News Catppuccin
@namespace github.com/catppuccin/userstyles/styles/hacker-news
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/hacker-news
@version 0.1.1
Expand Down
2 changes: 1 addition & 1 deletion styles/hoppscotch/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name Hoppscotch.io Catppuccin
@name Hoppscotch Catppuccin
@namespace github.com/catppuccin/userstyles/styles/hoppscotch
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/hoppscotch
@version 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion styles/lichess/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name Lichess Catppuccin
@name lichess Catppuccin

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make the name uppercase in userstyles.yml (and here), see #346 (comment) for the conversation from a while back

@namespace github.com/catppuccin/userstyles/styles/lichess
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/lichess
@version 0.0.1
Expand Down
4 changes: 0 additions & 4 deletions styles/reddit/catppuccin.user.css
Original file line number Diff line number Diff line change
Expand Up @@ -1133,10 +1133,6 @@
.snoo-cls-11 {
fill: @sky;
}

.snoo-cls-11 {
fill: @sky;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion styles/whatsapp-web/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name WhatsApp Web Catppuccin
@name WhatsApp Web Catppuccin
@namespace github.com/catppuccin/userstyles/styles/whatsapp-web
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/whatsapp-web
@version 0.0.4
Expand Down
2 changes: 1 addition & 1 deletion styles/wikiwand/catppuccin.user.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ==UserStyle==
@name Wikiwand Catppuccin

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we need to change userstyles.yml here as well:
Screenshot 2023-12-14 at 11 46 00 (Arc)

@name WikiWand Catppuccin
@namespace github.com/catppuccin/userstyles/styles/wikiwand
@homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/wikiwand
@version 1.2.0
Expand Down