commit db2d8ac6064f9eaafa7e33b457fb43ad98c204da 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..3be9885 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,21 @@ + + + pride_flags + Pride Flags + Add pride flags to your nextcloud + + 0.1.2 + cnvpl + + PrideFlags + customization + https://github.com/finallycoffee/nextcloud-pride/issues + + + + + OCA\PrideFlags\Settings\PersonalSection + OCA\PrideFlags\Settings\PersonalSettings + + diff --git a/appinfo/routes.php b/appinfo/routes.php new file mode 100644 index 0000000..d7f9475 --- /dev/null +++ b/appinfo/routes.php @@ -0,0 +1,7 @@ + [ +// ['name' => '', 'url' => '', 'verb' => ''] + ] +]; 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..4d6cfc6 --- /dev/null +++ b/js/pride.js @@ -0,0 +1,66 @@ +const flags = [ + { + id: 'pride', + colors: ['#E04641', '#DE7E41', '#E4D56F', '#55B85F', '#2473B5', '#6F5DA5'], + transform: 'rotate(90)' + }, { + id: 'trans', + colors: ['#55CDFC', '#F7A8B8', '#FFFFFF', '#F7A8B8', '#55CDFC'], + transform: 'rotate(90)' + } +]; + +const generateGradient = colors => { + const steps = colors.length; + return colors.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).join('\n')} + + + + + `; +}; + +flags.forEach(flag => { + const svg_html = makeLinearGradientSvg(flag.id, flag.colors, flag.opacity ?? '0.8', flag.transform ?? 'rotate(0)'); + const container = document.createElement('div'); + container.classList.add('hidden-visually'); + container.ariaHidden = true; + container.innerHTML = svg_html; + const style_c = document.createElement('style'); + style_c.textContent = ` + body { + --image-background-pride-${flag.id}: url('data:image/svg+xml;base64,${btoa(svg_html)}'); + } + #app-navigation ul > li.active, + .button-vue--vue-primary, + .preview-card__header, + .profile__primary-action-button, + .app-navigation-entry.active { + background-image: var(--image-background-pride-trans) !important; + } + .material-design-icon__svg, + .checkbox-radio-switch svg { + fill: url(#gradient-trans); + } + `; + document.body.prepend(container); + document.head.prepend(style_c); +}); diff --git a/lib/AppConstants.php b/lib/AppConstants.php new file mode 100644 index 0000000..e2be724 --- /dev/null +++ b/lib/AppConstants.php @@ -0,0 +1,9 @@ +get(IConfig::class); + } + + public function boot(IBootContext $ctx): void { + Util::addStyle(self::APP_ID, 'pride'); + Util::addScript(self::APP_ID, 'pride'); + } +} diff --git a/lib/Settings/PersonalSection.php b/lib/Settings/PersonalSection.php new file mode 100644 index 0000000..02395f4 --- /dev/null +++ b/lib/Settings/PersonalSection.php @@ -0,0 +1,29 @@ +urlGenerator->imagePath('core', 'settings-dark.svg'); + } +} diff --git a/lib/Settings/PersonalSettings.php b/lib/Settings/PersonalSettings.php new file mode 100644 index 0000000..b8a9297 --- /dev/null +++ b/lib/Settings/PersonalSettings.php @@ -0,0 +1,24 @@ + +
+
+

Personal preferences

+

Configure which pride flags you want where

+ +
+