diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23833b6..ff1ce80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: env: BUILD_TYPE: Release - tag: "0.1.2" + tag: "0.1.3" name: libaloo releases @@ -40,7 +40,8 @@ jobs: tag_name: v${{ env.tag }} release_name: Release v${{ env.tag }} body: | - Added Create App to python TUI + As Vala already exists, I don't actually need to create a new framework + But maybe I will continue it someday, for now it is paused draft: false prerelease: false - name: Lib aloo deb file diff --git a/index.html b/index.html deleted file mode 100644 index 04e7012..0000000 --- a/index.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - material testing - - - - - - - - diff --git a/scripts/src/__init__.py b/scripts/src/__init__.py index 8113eb6..07b41b4 100755 --- a/scripts/src/__init__.py +++ b/scripts/src/__init__.py @@ -704,11 +704,14 @@ def createApp() -> None: currFilePath + "styles/colors.css", "r", ).read() - materialCSS = open( - currFilePath + "styles/material.css", + lightCSS = open( + currFilePath + "styles/light.css", + "r", + ).read() + darkCSS = open( + currFilePath + "styles/dark.css", "r", ).read() - try: while colorsCSS.index("\t") != -1: colorsCSS = colorsCSS.replace("\t", "") @@ -719,23 +722,39 @@ def createApp() -> None: colorsCSS = colorsCSS.replace("\n", "") except: pass - try: - while materialCSS.index("\t") != -1: - materialCSS = materialCSS.replace("\t", "") + while lightCSS.index("\t") != -1: + lightCSS = lightCSS.replace("\t", "") + except: + pass + try: + while lightCSS.index("\n") != -1: + lightCSS = lightCSS.replace("\n", "") except: pass try: - while materialCSS.index("\n") != -1: - materialCSS = materialCSS.replace("\n", "") + while darkCSS.index("\t") != -1: + darkCSS = darkCSS.replace("\t", "") + except: + pass + try: + while darkCSS.index("\n") != -1: + darkCSS = darkCSS.replace("\n", "") except: pass os.mkdir(appInfo["project-name"] + "styles") - cssBundle = open( - appInfo["project-name"] + "styles/material.bundle.min.css", + open( + appInfo["project-name"] + "styles/colors.bundle.min.css", "w+", - ) - cssBundle.write(materialCSS + colorsCSS) + ).write(colorsCSS) + open( + appInfo["project-name"] + "styles/light.bundle.min.css", + "w+", + ).write(lightCSS) + open( + appInfo["project-name"] + "styles/dark.bundle.min.css", + "w+", + ).write(darkCSS) print("\t\033[1;32m󰄭 Aloo project created successfully\033[0m") os.system("tput smcup") diff --git a/scripts/src/aloocli.py b/scripts/src/aloocli.py index 1294c66..affebc9 100755 --- a/scripts/src/aloocli.py +++ b/scripts/src/aloocli.py @@ -104,27 +104,60 @@ def createApp(projectOption: str) -> None: currFilePath + "styles/colors.css", "r", ).read() - materialCSS = open( - currFilePath + "styles/material.css", + + lightCSS = open( + currFilePath + "styles/light.css", + "r", + ).read() + darkCSS = open( + currFilePath + "styles/dark.css", "r", ).read() - while colorsCSS.index("\t") != -1: - colorsCSS = colorsCSS.replace("\t", "") - while colorsCSS.index("\n") != -1: - colorsCSS = colorsCSS.replace("\n", "") - - while materialCSS.index("\t") != -1: - materialCSS = materialCSS.replace("\t", "") - while materialCSS.index("\n") != -1: - materialCSS = materialCSS.replace("\n", "") + try: + while colorsCSS.index("\t") != -1: + colorsCSS = colorsCSS.replace("\t", "") + except: + pass + try: + while colorsCSS.index("\n") != -1: + colorsCSS = colorsCSS.replace("\n", "") + except: + pass + try: + while lightCSS.index("\t") != -1: + lightCSS = lightCSS.replace("\t", "") + except: + pass + try: + while lightCSS.index("\n") != -1: + lightCSS = lightCSS.replace("\n", "") + except: + pass + try: + while darkCSS.index("\t") != -1: + darkCSS = darkCSS.replace("\t", "") + except: + pass + try: + while darkCSS.index("\n") != -1: + darkCSS = darkCSS.replace("\n", "") + except: + pass os.mkdir(projectPath + "styles") - cssBundle = open( - projectPath + "styles/material.bundle.min.css", + open( + projectPath + "styles/colors.bundle.min.css", "w+", - ) - cssBundle.write(materialCSS + colorsCSS) + ).write(colorsCSS) + open( + projectPath + "styles/light.bundle.min.css", + "w+", + ).write(lightCSS) + open( + projectPath + "styles/dark.bundle.min.css", + "w+", + ).write(darkCSS) print("\t\033[1;32m󰄭 Aloo project created successfully\033[0m") @@ -193,9 +226,12 @@ def run(runWhat_App_Test: str) -> None: def cssMainLatest(): h1 = http.client.HTTPSConnection("raw.githubusercontent.com") - h1.request("GET", "/BhJaipal/libaloo/main/scripts/src/styles/material.css") + h1.request("GET", "/BhJaipal/libaloo/main/scripts/src/styles/light.css") + response = h1.getresponse() + lightCSSBytes: bytes = response.read() + h1.request("GET", "/BhJaipal/libaloo/main/scripts/src/styles/dark.css") response = h1.getresponse() - materialCSSBytes: bytes = response.read() + darkCSSBytes: bytes = response.read() h1.request("GET", "/BhJaipal/libaloo/main/scripts/src/styles/colors.css") response = h1.getresponse() colorsCSSBytes: bytes = response.read() @@ -212,27 +248,47 @@ def cssMainLatest(): pass try: - while materialCSSBytes.index(b"\t") != -1: - materialCSSBytes = materialCSSBytes.replace(b"\t", b"") + while lightCSSBytes.index(b"\t") != -1: + lightCSSBytes = lightCSSBytes.replace(b"\t", b"") + except: + pass + try: + while lightCSSBytes.index(b"\n") != -1: + lightCSSBytes = lightCSSBytes.replace(b"\n", b"") except: pass try: - while materialCSSBytes.index(b"\n") != -1: - materialCSSBytes = materialCSSBytes.replace(b"\n", b"") + while darkCSSBytes.index(b"\t") != -1: + darkCSSBytes = darkCSSBytes.replace(b"\t", b"") except: pass - cssBundle = open( - "styles/material.bundle.min.css", + try: + while darkCSSBytes.index(b"\n") != -1: + darkCSSBytes = darkCSSBytes.replace(b"\n", b"") + except: + pass + open( + "styles/colors.bundle.min.css", "w+", - ) - cssBundle.write(materialCSSBytes.decode() + colorsCSSBytes.decode()) + ).write(colorsCSSBytes.decode()) + open( + "styles/light.bundle.min.css", + "w+", + ).write(lightCSSBytes.decode()) + open( + "styles/dark.bundle.min.css", + "w+", + ).write(darkCSSBytes.decode()) def cssStableLatest(): h1 = http.client.HTTPSConnection("raw.githubusercontent.com") - h1.request("GET", "/BhJaipal/libaloo/release/scripts/src/styles/material.css") + h1.request("GET", "/BhJaipal/libaloo/release/scripts/src/styles/light.css") + response = h1.getresponse() + lightCSSBytes: bytes = response.read() + h1.request("GET", "/BhJaipal/libaloo/release/scripts/src/styles/dark.css") response = h1.getresponse() - materialCSSBytes: bytes = response.read() + darkCSSBytes: bytes = response.read() h1.request("GET", "/BhJaipal/libaloo/release/scripts/src/styles/colors.css") response = h1.getresponse() colorsCSSBytes: bytes = response.read() @@ -249,21 +305,37 @@ def cssStableLatest(): pass try: - while materialCSSBytes.index(b"\t") != -1: - materialCSSBytes = materialCSSBytes.replace(b"\t", b"") + while lightCSSBytes.index(b"\t") != -1: + lightCSSBytes = lightCSSBytes.replace(b"\t", b"") + except: + pass + try: + while lightCSSBytes.index(b"\n") != -1: + lightCSSBytes = lightCSSBytes.replace(b"\n", b"") except: pass try: - while materialCSSBytes.index(b"\n") != -1: - materialCSSBytes = materialCSSBytes.replace(b"\n", b"") + while darkCSSBytes.index(b"\t") != -1: + darkCSSBytes = darkCSSBytes.replace(b"\t", b"") except: pass - cssBundle = open( - "styles/material.bundle.min.css", + try: + while darkCSSBytes.index(b"\n") != -1: + darkCSSBytes = darkCSSBytes.replace(b"\n", b"") + except: + pass + open( + "styles/colors.bundle.min.css", "w+", - ) - cssBundle.write(materialCSSBytes.decode() + colorsCSSBytes.decode()) - pass + ).write(colorsCSSBytes.decode()) + open( + "styles/light.bundle.min.css", + "w+", + ).write(lightCSSBytes.decode()) + open( + "styles/dark.bundle.min.css", + "w+", + ).write(darkCSSBytes.decode()) term = blessed.Terminal() diff --git a/scripts/src/styles/color.css b/scripts/src/styles/color.css index cf0dc8a..aac25fa 100644 --- a/scripts/src/styles/color.css +++ b/scripts/src/styles/color.css @@ -1,4 +1,5 @@ :root { + --skyblue-100: #c6e1fa; --skyblue-200: #a5d1fa; --skyblue-300: #84c2fc; --skyblue-400: #4ba6fc; diff --git a/scripts/src/styles/dark.css b/scripts/src/styles/dark.css index 0c3fbcc..577c8e7 100644 --- a/scripts/src/styles/dark.css +++ b/scripts/src/styles/dark.css @@ -75,7 +75,3 @@ display: flex; flex-direction: row-reverse; } - -body { - background-color: black; -} diff --git a/scripts/src/styles/light.css b/scripts/src/styles/light.css index c7bf727..8541f77 100644 --- a/scripts/src/styles/light.css +++ b/scripts/src/styles/light.css @@ -14,7 +14,7 @@ } .material-filled-btn { background-color: var(--skyblue-600); - color: whitesmoke; + color: white; box-shadow: 0px 1px 5px -4px rgba(0, 0, 0.5); } .material-filled-btn:hover { @@ -24,9 +24,59 @@ border: 1px solid var(--skyblue-400); background-color: white; } +@keyframes material-outlined-animation { + 0% { + background-color: transparent; + background-image: radial-gradient( + circle at top, + var(--skyblue-100) 0%, + white 100% + ), + radial-gradient(circle at bottom, var(--skyblue-100) 0%, white 100%); + } + 25% { + background-color: transparent; + background-image: radial-gradient( + circle at top, + var(--skyblue-100) 25%, + white 75% + ), + radial-gradient(circle at bottom, var(--skyblue-100) 25%, white 75%); + } + 50% { + background-color: transparent; + background-image: radial-gradient( + circle at top, + var(--skyblue-100) 50%, + white 50% + ), + radial-gradient(circle at bottom, var(--skyblue-100) 50%, white 50%); + } + 75% { + background-color: transparent; + background-image: radial-gradient( + circle at top, + var(--skyblue-100) 75%, + white 25% + ), + radial-gradient(circle at bottom, var(--skyblue-100) 75%, white 25%); + } + 100% { + background-color: transparent; + background-image: radial-gradient( + circle at top, + var(--skyblue-100) 100%, + white 0% + ), + radial-gradient(circle at bottom, var(--skyblue-100) 100%, white 0%); + } +} .material-outlined-btn:hover { background-color: var(--gray-50); } +.material-outlined-btn:active { + animation: material-outlined-animation 300ms ease-in-out; +} /* Material Card */ .material-card { border-radius: 10px; diff --git a/src/common/window.c b/src/common/window.c index 70c0966..652f55f 100644 --- a/src/common/window.c +++ b/src/common/window.c @@ -59,19 +59,7 @@ const char *readLine(FILE *file) { } AlooWidget *__alooApplicationNewWindow(AlooApplication *app) { - CSS.importPath("styles/material.bundle.min.css"); - char *home = getenv("$HOME"); - strcat(home, "/.config/gtk-4.0/settings.ini"); - FILE *settingsIni = fopen(home, "r"); - while (!feof(settingsIni)) { - const char *line = readLine(settingsIni); - if (strncmp("gtk-application-prefer-dark-theme", line, - strlen("gtk-application-prefer-dark-theme"))) { - if (home[strlen(home) - 1] == '0') - CSS.importPath("styles/light.bundle.min.css"); - else CSS.importPath("styles/dark.bundle.min.css"); - } - } + CSS.importPath("styles/colors.bundle.min.css"); return Widget.gtk_to_aloo(gtk_application_window_new(app->app)); } AlooWidget *__alooSetWindowTitle(AlooWidget *window, const char *title) { @@ -91,19 +79,7 @@ AlooWidget *__getWindowSize(AlooWidget *window, int *width, int *height) { } AlooWidget *__setWindowApplication(AlooWidget *window, AlooApplication *app) { - CSS.importPath("styles/material.bundle.min.css"); - char *home = getenv("$HOME"); - strcat(home, "/.config/gtk-4.0/settings.ini"); - FILE *settingsIni = fopen(home, "r"); - while (!feof(settingsIni)) { - const char *line = readLine(settingsIni); - if (strncmp("gtk-application-prefer-dark-theme", line, - strlen("gtk-application-prefer-dark-theme"))) { - if (home[strlen(home) - 1] == '0') - CSS.importPath("styles/light.bundle.min.css"); - else CSS.importPath("styles/dark.bundle.min.css"); - } - } + CSS.importPath("styles/colors.bundle.min.css"); gtk_window_set_application(GTK_WINDOW(window->child), app->app); return window; }