1
0
Fork 0

mastodon: use tangerine-ui theme

This commit is contained in:
Daniel Kempkens 2024-01-10 19:16:01 +01:00
parent af610e1ff8
commit 8cd499b3dd
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -6,47 +6,25 @@ let
pkg-mastodon = pkgs.mastodon.overrideAttrs (_: { pkg-mastodon = pkgs.mastodon.overrideAttrs (_: {
mastodonModules = pkgs.mastodon.mastodonModules.overrideAttrs (oldMods: mastodonModules = pkgs.mastodon.mastodonModules.overrideAttrs (oldMods:
let let
# https://github.com/ronilaukkarinen/mastodon-bird-ui tangerine-ui = pkgs.fetchFromGitHub {
birdui-version = "1.8.2"; owner = "nileane";
repo = "TangerineUI-for-Mastodon";
birdui-single-column = builtins.fetchurl { rev = "v1.9.4";
url = "https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/${birdui-version}/layout-single-column.css"; hash = "sha256-ejAmITS4DKeaLetcqZr8LEhLdlDUkKwKXlG7rY1PN1E=";
sha256 = "0xlnykliqm7qrkw6ym14mxdvx3mb1mmyvjyq7ly32kkx3i2mcc47";
};
birdui-multi-column = builtins.fetchurl {
url = "https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/${birdui-version}/layout-multiple-columns.css";
sha256 = "0wz0kj3p1sa7lf00qj6l83hnl42zrfkb90s085m0q896hy42za9i";
}; };
in in
{ {
pname = "${oldMods.pname}+themes"; pname = "${oldMods.pname}+themes";
postPatch = '' postPatch = ''
# Import theme
styleDir=$PWD/app/javascript/styles styleDir=$PWD/app/javascript/styles
birduiDir=$styleDir/mastodon-bird-ui
mkdir -p $birduiDir cp -r ${tangerine-ui}/mastodon/app/javascript/styles/* $styleDir
cat ${birdui-single-column} >$birduiDir/layout-single-column.scss
cat ${birdui-multi-column} >$birduiDir/layout-multiple-columns.scss
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' $birduiDir/layout-single-column.scss ls -la $styleDir
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' $birduiDir/layout-single-column.scss
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' $birduiDir/layout-multiple-columns.scss echo "tangerineui: styles/tangerineui.scss" >>$PWD/config/themes.yml
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' $birduiDir/layout-multiple-columns.scss echo "tangerineui-purple: styles/tangerineui-purple.scss" >>$PWD/config/themes.yml
echo -e "@import 'contrast/variables';\n@import 'application';\n@import 'contrast/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-contrast.scss
echo -e "@import 'mastodon-light/variables';\n@import 'application';\n@import 'mastodon-light/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-light.scss
echo -e "@import 'application';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-dark.scss
# Build theme
echo "mastodon-bird-ui-dark: styles/mastodon-bird-ui-dark.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-light: styles/mastodon-bird-ui-light.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-contrast: styles/mastodon-bird-ui-contrast.scss" >>$PWD/config/themes.yml
''; '';
}); });
@ -54,13 +32,11 @@ let
postBuild = '' postBuild = ''
# Make theme available # Make theme available
echo "mastodon-bird-ui-dark: styles/mastodon-bird-ui-dark.scss" >>$PWD/config/themes.yml echo "tangerineui: styles/tangerineui.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-light: styles/mastodon-bird-ui-light.scss" >>$PWD/config/themes.yml echo "tangerineui-purple: styles/tangerineui-purple.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-contrast: styles/mastodon-bird-ui-contrast.scss" >>$PWD/config/themes.yml
yq -i '.en.themes.mastodon-bird-ui-dark = "Mastodon Bird UI (Dark)"' $PWD/config/locales/en.yml yq -i '.en.themes.tangerineui = "Tangerine UI"' $PWD/config/locales/en.yml
yq -i '.en.themes.mastodon-bird-ui-light = "Mastodon Bird UI (Light)"' $PWD/config/locales/en.yml yq -i '.en.themes.tangerineui-purple = "Tangerine UI (Purple)"' $PWD/config/locales/en.yml
yq -i '.en.themes.mastodon-bird-ui-contrast = "Mastodon Bird UI (High contrast)"' $PWD/config/locales/en.yml
''; '';
}); });
in in