Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ vendor/
repo/
gradle-deps/
vendor-uniffi/
webApp/src/wasm/
webApp/src/wasm/

/.direnv
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
inputs:
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import inputs.nixpkgs {
inherit system;
config.android_sdk.accept_license = true;
config.allowUnfree = true;
};

androidRelease =
let
importYAML =
file:
builtins.fromJSON (
builtins.readFile (
pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"''
)
);
in
importYAML ./.github/workflows/release-android.yml;

# this must be a full version, since it's used to find aapt2
buildToolsVersion = androidRelease.env.ANDROID_BUILD_TOOLS;

androidComposition = pkgs.androidenv.composeAndroidPackages {
platformVersions = [ androidRelease.env.ANDROID_API ];
buildToolsVersions = [ buildToolsVersion ];
includeNDK = true;
};

androidSdk = androidComposition.androidsdk;
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# not really required here
androidSdk

openjdk21

cargo
rustc
];

# source: https://wiki.nixos.org/wiki/Android#gradlew
# override the aapt2 that gradle uses with the nix-shipped version
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/${buildToolsVersion}/aapt2";

ANDROID_HOME = "${androidSdk}/libexec/android-sdk";
};
}
);
}
2 changes: 2 additions & 0 deletions shared/src/commonMain/kotlin/org/mlm/mages/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private fun AppContent(
ThemeMode.System -> isSystemInDarkTheme()
ThemeMode.Dark -> true
ThemeMode.Light -> false
ThemeMode.Black -> true
}
val widgetTheme = if (isDark) "dark" else "light"
val elementCallUrl =
Expand All @@ -149,6 +150,7 @@ private fun AppContent(
ProvideAppLocale(settings.appLanguageTagOrNull()) {
MainTheme(
darkTheme = isDark,
blackTheme = settings.themeMode == ThemeMode.Black,
dynamicColors = settings.dynamicColors
) {
val languageTag = LocalAppLocale.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data class AppSettings(

@Setting(
title = "Theme",
description = "System / Light / Dark",
description = "System / Light / Dark / Black",
category = Appearance::class,
type = Dropdown::class,
)
Expand Down
31 changes: 30 additions & 1 deletion shared/src/commonMain/kotlin/org/mlm/mages/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ private val DarkColorScheme = darkColorScheme(
onTertiaryContainer = Color(0xFFFFD8E4)
)

private val BlackColorScheme = darkColorScheme(
primary = AppColors.Purple80,
secondary = AppColors.PurpleGrey80,
tertiary = AppColors.Pink80,

surface = Color(0xFF1A1C1E),
onSurface = Color(0xFFE2E2E6),
surfaceVariant = Color(0xFF44474E),
onSurfaceVariant = Color(0xFFC4C6D0),

surfaceBright = Color(0xFF38393E),
surfaceDim = Color(0xFF121318),
surfaceContainerLowest = Color(0xFF0C0E13),
surfaceContainerLow = Color(0xFF1A1C22),
surfaceContainer = Color(0xFF1E2025),
surfaceContainerHigh = Color(0xFF282A2F),
surfaceContainerHighest = Color(0xFF33353A),

background = Color(0xFF000000),
onBackground = Color(0xFFE2E2E6),
primaryContainer = Color(0xFF4F378B),
onPrimaryContainer = Color(0xFFEADDFF),
secondaryContainer = Color(0xFF36424C),
onSecondaryContainer = Color(0xFFDCE7F1),
tertiaryContainer = Color(0xFF633B48),
onTertiaryContainer = Color(0xFFFFD8E4)
)

private val LightColorScheme = lightColorScheme(
primary = AppColors.Purple40,
secondary = AppColors.PurpleGrey40,
Expand Down Expand Up @@ -93,11 +121,12 @@ val AppShapes = Shapes(
@Composable
fun MainTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
blackTheme: Boolean = false,
dynamicColors: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = getDynamicColorScheme(darkTheme, dynamicColors)
?: if (darkTheme) DarkColorScheme else LightColorScheme
?: if (blackTheme) BlackColorScheme else if (darkTheme) DarkColorScheme else LightColorScheme

MaterialExpressiveTheme(
colorScheme = colorScheme,
Expand Down