commit 685350d476534cb99fb9b34ee063ad0d9a81bc68 Author: transcaffeine Date: Sun Jul 28 17:57:30 2024 +0200 initial commit diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100644 index 0000000..729b96b --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,17 @@ + + + pride + Pride + Add pride flags to your nextcloud + + 0.1.0 + cnvpl + + Pride + customization + https://github.com/finallycoffee/nextcloud-pride/issues + + + + diff --git a/css/pride.css b/css/pride.css new file mode 100644 index 0000000..06982fa --- /dev/null +++ b/css/pride.css @@ -0,0 +1,3 @@ +.files-list__row-icon .folder-icon svg { + fill: url("#gradient-pride"); +} diff --git a/js/pride.js b/js/pride.js new file mode 100644 index 0000000..1d6e2e3 --- /dev/null +++ b/js/pride.js @@ -0,0 +1,43 @@ +const flags = [ + { + id: 'gradient-pride', + colors: ['#E04641', '#DE7E41', '#E4D56F', '#55B85F', '#2473B5', '#6F5DA5'], + transform: 'rotate(90)' + }, { + id: 'gradient-trans', + colors: ['#55CDFC', '#F7A8B8', '#FFFFFF', '#F7A8B8', '#55CDFC'], + transform: 'rotate(90)' + } +]; + +const generateGradient = colors => { + const steps = colors.length; + return steps.map((color, index) => { return [ + [color, (index / steps)], + [color, (index + 1) / steps] + ]}).flat(); +}; + +const generateStops = (colors, opacity) => { + return generateGradient(colors).map((color, offset) => { + return ``; + }); +}; + +const makeLinearGradientSvg = (id, colors, opacity, transform) => { + return ` + + + ${generateStops(colors, opacity)} + + + `; +}; + +flags.forEach(flag => { + const container = document.createElement('div'); + container.classList.add('hidden-visually'); + container.ariaHidden = true; + container.innerHTML = makeLinearGradientSvg(flag.id, flag.colors, flag.opacity ?? '0.8', flag.transform ?? 'rotate(0)'); + document.body.prepend(container); +}); diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 0000000..384a1df --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,27 @@ +get(IConfig::class); + } + + public function boot(IBootContext $ctx): void { + Util::addStyle(self::APP_ID, 'pride'); + Util::addScript(self::APP_ID, 'pride'); + } +}