From b4a9cd9d540d42a61bee9045d41ada392305a8d5 Mon Sep 17 00:00:00 2001 From: Akash Keshav <112591754+domesticchores@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:53:32 -0400 Subject: add light/dark mode toggle, only homepage is fully functional. -ak --- ufund-ui/public/cr.png | Bin 0 -> 1548178 bytes ufund-ui/public/jf.png | Bin 1159826 -> 819422 bytes ufund-ui/src/app/app.component.css | 1 - ufund-ui/src/app/app.component.html | 7 ++-- ufund-ui/src/app/app.component.ts | 6 +++ .../components/home-page/home-page.component.css | 16 ++++++-- .../components/home-page/home-page.component.html | 10 +++-- .../components/home-page/home-page.component.ts | 16 +++++++- ufund-ui/src/index.html | 2 +- ufund-ui/src/styles.css | 45 ++++++++++++++++----- 10 files changed, 78 insertions(+), 25 deletions(-) create mode 100644 ufund-ui/public/cr.png diff --git a/ufund-ui/public/cr.png b/ufund-ui/public/cr.png new file mode 100644 index 0000000..2d9a5a1 Binary files /dev/null and b/ufund-ui/public/cr.png differ diff --git a/ufund-ui/public/jf.png b/ufund-ui/public/jf.png index bbf95d5..94250ec 100644 Binary files a/ufund-ui/public/jf.png and b/ufund-ui/public/jf.png differ diff --git a/ufund-ui/src/app/app.component.css b/ufund-ui/src/app/app.component.css index f4ed668..6cb44f6 100644 --- a/ufund-ui/src/app/app.component.css +++ b/ufund-ui/src/app/app.component.css @@ -34,7 +34,6 @@ /*}*/ a { - color: light-dark(black, white); text-decoration: none; } diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index f697695..a6e6e6a 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -5,12 +5,13 @@
- Dashboard - Cupboard - Basket + + + +
diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index bc0e71a..635061c 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -49,5 +49,11 @@ export class AppComponent implements OnInit { location.reload() } + toggleColorScheme() { + let newTheme = this.document.body.parentElement!.getAttribute("theme") == "light" ? "dark" : "light"; + this.document.body.parentElement!.setAttribute("theme",newTheme); + console.log(newTheme, this.document.body.parentElement); + } + protected readonly userType = userType; } diff --git a/ufund-ui/src/app/components/home-page/home-page.component.css b/ufund-ui/src/app/components/home-page/home-page.component.css index a10377f..f6e5631 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.css +++ b/ufund-ui/src/app/components/home-page/home-page.component.css @@ -6,7 +6,6 @@ justify-content: center; overflow: clip; } - #hero { display: flex; /*flex-direction: column;*/ @@ -19,12 +18,21 @@ h1 { max-width: 1200px; } +#cr { + opacity: var(--opacity-cr); +} + #jf { - /*position: absolute;*/ + opacity: var(--opacity-jf); +} + +.text-highlight { + text-decoration: underline; + color: var(--highlight-color); } #right { - max-width: 500px; + max-width: 450px; max-height: 500px; display: flex; justify-content: center; @@ -33,6 +41,6 @@ h1 { } #left { - max-width: 500px; + max-width: 550px; z-index: 1; } diff --git a/ufund-ui/src/app/components/home-page/home-page.component.html b/ufund-ui/src/app/components/home-page/home-page.component.html index 7a7ff96..051132e 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.html +++ b/ufund-ui/src/app/components/home-page/home-page.component.html @@ -1,10 +1,14 @@
-

Helping fund coral reef and marine life conservation

+

Helping fund coral reef and + marine life conservation.

View our online cupboard holding all needs related to sea life preservation

- +
diff --git a/ufund-ui/src/app/components/home-page/home-page.component.ts b/ufund-ui/src/app/components/home-page/home-page.component.ts index 95e8962..71c2549 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.ts +++ b/ufund-ui/src/app/components/home-page/home-page.component.ts @@ -1,4 +1,5 @@ -import {Component} from '@angular/core'; +import {Component, Inject, OnInit} from '@angular/core'; +import { DOCUMENT } from '@angular/common'; @Component({ selector: 'app-home-page', @@ -6,6 +7,17 @@ import {Component} from '@angular/core'; templateUrl: './home-page.component.html', styleUrl: './home-page.component.css' }) -export class HomePageComponent { +export class HomePageComponent implements OnInit { + + constructor( + @Inject(DOCUMENT) private document: Document + ) {} + ngOnInit(): void { + console.log(this.document.documentElement); + } + + + + } diff --git a/ufund-ui/src/index.html b/ufund-ui/src/index.html index b6ae1a2..34b631c 100644 --- a/ufund-ui/src/index.html +++ b/ufund-ui/src/index.html @@ -1,5 +1,5 @@ - + UfundUi diff --git a/ufund-ui/src/styles.css b/ufund-ui/src/styles.css index 75d6b36..a1902fd 100644 --- a/ufund-ui/src/styles.css +++ b/ufund-ui/src/styles.css @@ -1,17 +1,38 @@ /* You can add global styles to this file, and also import other style files */ :root { - color-scheme: /*light*/ dark; + color-scheme: dark; } * { box-sizing: border-box; + color: var(--foreground-color); + transition: all ease-in-out .3s; +} + +[theme="light"] { + --background-color: #e6e4df; + --foreground-color: #000000; + --highlight-color: #cf9451; + --hover-color: #d8cdc0; + --opacity-cr: 1; + --opacity-jf: 0; +} + +[theme="dark"] { + --background-color: #000715; + --foreground-color: #ffffff; + --highlight-color: #6091e8; + --hover-color: #394559; + --opacity-cr: 0; + --opacity-jf: 1; } html, body { margin: 0; height: 100%; - background-color: light-dark(white, #000715); + background-color: var(--background-color); + color: var(--foreground-color); } body { @@ -25,37 +46,39 @@ input { border-radius: 5px; border-style: solid; border-width: 1px; - background-color: light-dark(#ebebeb, #3a3a3a); + background-color: var(--background-color); &:hover { - background-color: light-dark(#e1e1e1, #444444); + background-color: var(--hover-color); } } button, input[type=button], input[type=reset], input[type=submit], .button { - font-size: 14pt; + font-size: 12pt; padding: 6px 16px; border-radius: 9999px; border-style: none; - background-color: light-dark(#ebebeb, #3a3a3a); + font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + background-color: var(--background-color); display: flex; gap: 5px; text-align: center; justify-content: center; &:hover { - background-color: light-dark(#e1e1e1, #444444); + background-color: var(--hover-color); } } .button2 { - text-transform: uppercase; - border: 1px solid #5cdbff; + /* text-transform: uppercase; */ + border: 3px solid var(--highlight-color); padding: 10px 25px; + font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 12pt; - font-weight: 600; + font-weight: 700; background-color: transparent; - text-shadow: #5cdbff 0 0 50px; + text-shadow: var(--highlight-color) 0 0 50px; } .icon { -- cgit v1.2.3