Add yaml loading of themes, convert themes to yaml; also minnor boot speed fix with delayed, and removed superfulous return from gobmobile Start
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Dan Ballard 2023-10-19 08:29:05 -07:00
parent 69b7ddb2c1
commit 705bffc857
27 changed files with 764 additions and 726 deletions

102
assets/themes/cwtch.yml Normal file
View File

@ -0,0 +1,102 @@
---
colors:
darkGreyPurple: 0x281831
deepPurple: 0x422850
mauvePurple: 0x8E64A5
whiteishPurple: 0xE3DFE4
lightGrey: 0x9E9E9E
softGreen: 0xA0FFB0
softRed: 0xFFA0B0
whitePurple: 0xFFFDFF
softPurple: 0xFDF3FC
purple: 0xDFB9DE
brightPurple: 0xD1B0E0 # not in new: portrait badge color
darkPurple: 0x350052
greyPurple: 0x775F84 # not in new: portrait borders
pink: 0xE85DA1 # not in new: active button color
hotPink: 0xD20070 # #D01972)
softGrey: 0xB3B6B3 # not in new theme: blocked
themes:
name: cwtch
dark:
colors:
background: darkGreyPurple
header: darkGreyPurple
userBubble: mauvePurple
peerBubble: deepPurple
font: whiteishPurple
settings: whiteishPurple
accent: hotPink
theme:
backgroundHilightElementColor: deepPurple
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
defaultButtonDisabledColor: lightGrey
defaultButtonDisabledTextColor: darkGreyPurple
defaultButtonTextColor: whiteishPurple
dropShadowColor: mauvePurple
hilightElementColor: purple
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
portraitBackgroundColor: deepPurple
portraitBlockedBorderColor: lightGrey
portraitBlockedTextColor: lightGrey
portraitContactBadgeColor: hotPink
portraitContactBadgeTextColor: whiteishPurple
portraitOfflineBorderColor: purple
portraitOnlineBorderColor: whiteishPurple
portraitProfileBadgeColor: hotPink
portraitProfileBadgeTextColor: whiteishPurple
scrollbarDefaultColor: purple
sendHintTextColor: mauvePurple
textfieldBackgroundColor: deepPurple
textfieldBorderColor: deepPurple
textfieldErrorColor: hotPink
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: whitePurple
header: softPurple
userBubble: purple
peerBubble: softPurple
font: darkPurple
settings: darkPurple
accent: hotPink
theme:
backgroundHilightElementColor: softPurple
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
defaultButtonDisabledColor: softGrey
defaultButtonTextColor: whitePurple # ?
dropShadowColor: purple
hilightElementColor: purple
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitBackgroundColor: softPurple
portraitBlockedBorderColor: softGrey
portraitBlockedTextColor: softGrey
portraitContactBadgeColor: accent
portraitContactBadgeTextColor: whitePurple
portraitOfflineBorderColor: greyPurple
portraitOnlineBorderColor: greyPurple
portraitProfileBadgeColor: accent
portraitProfileBadgeTextColor: whitePurple
scrollbarDefaultColor: accent
sendHintTextColor: purple
textfieldBackgroundColor: purple
textfieldBorderColor: purple
textfieldErrorColor: hotPink
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

68
assets/themes/ghost.yml Normal file
View File

@ -0,0 +1,68 @@
---
colors:
darkDarkBlue: 0x000051
darkLightBlue: 0x1A237E
white: 0xFFFFFF
darkBlue: 0xAAB6FE
lighterDarkBlue: 0xC3CCFE
lightBlue: 0xE8EAF6
themes:
name: ghost
dark:
colors:
background: 0x0D0D1F
header: 0x0D0D1F
userBubble: darkLightBlue
peerBubble: darkDarkBlue
font: white
settings: 0xDFFFD
accent: darkLightBlue # Color(0xFFD20070)
theme:
backgroundHilightElementColor: darkDarkBlue
backgroundMainColor: background
backgroundPaneColor: header
defaultButtonColor: accent
dropShadowColor: darkBlue
mainTextColor: font
messageFromMeBackgroundColor: userBubble
messageFromMeTextColor: font
messageFromOtherBackgroundColor: peerBubble
messageFromOtherTextColor: font
scrollbarDefaultColor: darkLightBlue
sendHintTextColor: darkBlue
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: mainTextColor
toolbarIconColor: settings
topbarColor: header
light:
colors:
background: 0xFDFDFF
header: darkBlue
userBubble: darkBlue
peerBubble: lightBlue
font: 0x0D0D1F
settings: 0x0D0D1F
accent: darkBlue
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background
backgroundPaneColor: background
defaultButtonColor: accent
defaultButtonActiveColor: lighterDarkBlue
defaultButtonDisabledColor: peerBubble
dropShadowColor: darkBlue
mainTextColor: settings
messageFromMeBackgroundColor: userBubble
messageFromMeTextColor: font
messageFromOtherBackgroundColor: peerBubble
messageFromOtherTextColor: font
portraitContactBadgeColor: accent
scrollbarDefaultColor: accent
sendHintTextColor: lightBlue
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings
topbarColor: header

47
assets/themes/juniper.yml Normal file
View File

@ -0,0 +1,47 @@
---
themes:
name: juniper
dark:
colors:
background: 0x1B1B1B
backgroundAlt: 0x494949
header: 0x1B1B1B
userBubble: 0x373737
peerBubble: 0x494949
font: 0xFFFFFF
settings: 0xFFFDFF
accent: 0x9E6A56
accentAlt: 0x845A48
theme:
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
topbarColor: header # darkGreyPurple
mainTextColor: font # whiteishPurple
defaultButtonColor: accent # hotPink
textfieldHintColor: mainTextColor # TODO pick
toolbarIconColor: settings # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
backgroundHilightElementColor: accent
sendHintTextColor: accentAlt
hilightElementColor: accentAlt
defaultButtonTextColor: mainTextColor
defaultButtonDisabledColor: peerBubble
defaultButtonDisabledTextColor: peerBubble
textfieldErrorColor: accent
scrollbarDefaultColor: accent
portraitBackgroundColor: header
portraitOnlineBorderColor: font
portraitOfflineBorderColor: peerBubble
portraitBlockedBorderColor: peerBubble
portraitBlockedTextColor: peerBubble
portraitContactBadgeColor: accent
portraitContactBadgeTextColor: mainTextColor
portraitProfileBadgeColor: accent
portraitProfileBadgeTextColor: mainTextColor
dropShadowColor: accentAlt

58
assets/themes/mermaid.yml Normal file
View File

@ -0,0 +1,58 @@
---
colors:
lavender: 0xB194C1
themes:
name: mermaid
dark:
colors:
background: 0x102426
header: 0x102426
userBubble: 0x00838F
peerBubble: 0x00363A
font: 0xFFFFFF
settings: 0xF7FCFD
accent: 0x8E64A5
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
dropShadowColor: lavender
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xF7FCFD
header: 0x56C8D8
userBubble: 0x56C8D8
peerBubble: 0xB2EBF2
font: 0x102426
settings: 0x102426
accent: 0x8E64A5
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
dropShadowColor: peerBubble
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
scrollbarDefaultColor: accent
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

View File

@ -0,0 +1,59 @@
---
themes:
name: midnight
dark:
colors:
accentGray: 0xE0E0E0
background: 0x1B1B1B
backgroundAlt: 0x494949
header: 0x1B1B1B
userBubble: 0x373737
peerBubble: 0x494949
font: 0xFFFFFF
settings: 0xFFFDFF
accent: 0xD20070
theme:
backgroundHilightElementColor: backgroundAlt
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
dropShadowColor: accentGray
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
scrollbarDefaultColor: accentGray
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xFBFBFB # Color( 0xFFFDFF)
header: 0xE0E0E0
userBubble: 0xE0E0E0
peerBubble: 0xBABDBE
font: 0x1B1B1B
settings: 0x1B1B1B
accent: 0xD20070
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
portraitOfflineBorderColor: peerBubble
portraitOnlineBorderColor: font
scrollbarDefaultColor: accent
textfieldBackgroundColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

54
assets/themes/neon1.yml Normal file
View File

@ -0,0 +1,54 @@
---
themes:
name: neon1
dark:
colors:
background: 0x290826
header: 0x290826
userBubble: 0xD20070
peerBubble: 0x26A9A4
font: 0xFFFFFF
settings: 0xFFFDFF
accent: 0xA604FE
theme:
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
scrollbarDefaultColor: accent
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xFFFDFF
header: 0xFF94C2
userBubble: 0xFF94C2
peerBubble: 0xE7F6F6
font: 0x290826
settings: 0x290826
accent: 0xA604FE
theme:
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
dropShadowColor: userBubble
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
portraitOfflineBorderColor: peerBubble
portraitOnlineBorderColor: font
scrollbarDefaultColor: accent
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

55
assets/themes/neon2.yml Normal file
View File

@ -0,0 +1,55 @@
---
themes:
name: neon2
dark:
colors:
background: 0x290826
header: 0x290826
userBubble: 0xA604FE
peerBubble: 0x03AD00
font: 0xFFFFFF
settings: 0xFFFDFF
accent: 0xA604FE
theme:
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
scrollbarDefaultColor: accent
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
paleGreen: 0xE7F6F6
background: 0xFFFDFF
header: 0xD8C7E1
userBubble: 0xD8C7E1
peerBubble: 0x80E27E
font: 0x290826
settings: 0x290826
accent: 0xA604FE
theme:
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
dropShadowColor: userBubble
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
portraitOfflineBorderColor: peerBubble
portraitOnlineBorderColor: font
scrollbarDefaultColor: accent
textfieldBackgroundColor: paleGreen
textfieldBorderColor: peerBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

49
assets/themes/pumpkin.yml Normal file
View File

@ -0,0 +1,49 @@
---
themes:
name: pumpkin
dark:
colors:
background: 0x281831
header: 0x281831
userBubble: 0xB53D00
peerBubble: 0x422850
font: 0xFFFFFF
settings: 0xFFFBF6
accent: 0x8E64A5
theme:
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xFFFBF6
header: 0xFF9800
userBubble: 0xFF9800
peerBubble: 0xD8C7E1
font: 0x281831
settings: 0x281831
accent: 0x8E64A5
theme:
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
dropShadowColor: peerBubble
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
scrollbarDefaultColor: accent
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

52
assets/themes/vampire.yml Normal file
View File

@ -0,0 +1,52 @@
---
themes:
name: vampire
dark:
colors:
background: 0x281831
header: 0x281831
userBubble: 0x9A1218
peerBubble: 0x422850
font: 0xFFFFFF
settings: 0xFDFFFD
accent: 0x8E64A5
theme:
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
scrollbarDefaultColor: accent
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xFFFDFD
header: 0xD8C7E1
userBubble: 0xD8C7E1
peerBubble: 0xFFEBEE
font: 0x281831
settings: 0x281831
accent: 0x8E64A5
theme:
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
dropShadowColor: userBubble
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
scrollbarDefaultColor: accent
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

55
assets/themes/witch.yml Normal file
View File

@ -0,0 +1,55 @@
---
themes:
name: witch
dark:
colors:
background: 0x0E1E0E
header: 0x0E1E0E
userBubble: 0x1B5E20
peerBubble: 0x003300
font: 0xFFFFFF
settings: 0xFDFFFD
accent: 0xD20070
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background # darkGreyPurple
backgroundPaneColor: header # darkGreyPurple
defaultButtonColor: accent # hotPink
mainTextColor: font # whiteishPurple
messageFromMeBackgroundColor: userBubble # mauvePurple
messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple
scrollbarDefaultColor: accent
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: mainTextColor
toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple
light:
colors:
background: 0xFDFFFD
header: 0x80E27E
userBubble: 0x80E27E
peerBubble: 0xE8F5E9
font: 0x0E1E0E
settings: 0x0E1E0E
accent: 0xD20070
theme:
backgroundHilightElementColor: peerBubble
backgroundMainColor: background # whitePurple
backgroundPaneColor: background # whitePurple
defaultButtonColor: accent # hotPink
mainTextColor: settings
messageFromMeBackgroundColor: userBubble # brightPurple
messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple
portraitContactBadgeColor: accent
scrollbarDefaultColor: accent
textfieldBackgroundColor: peerBubble
textfieldBorderColor: userBubble
textfieldHintColor: font
toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple

View File

@ -72,7 +72,7 @@ class CwtchGomobile implements Cwtch {
}
String torPath = path.join(await androidLibraryDir, "libtor.so");
print("gomobile.dart: Start invokeMethod Start($cwtchDir, $torPath)...");
return cwtchPlatform.invokeMethod("Start", {"appDir": cwtchDir, "torPath": torPath});
cwtchPlatform.invokeMethod("Start", {"appDir": cwtchDir, "torPath": torPath});
}
@override

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:isolate';
import 'package:cwtch/config.dart';
import 'package:cwtch/notification_manager.dart';
import 'package:cwtch/themes/cwtch.dart';
@ -107,7 +108,12 @@ class FlwtchState extends State<Flwtch> with WindowListener {
cwtch = CwtchFfi(cwtchNotifier);
}
print("initState: invoking cwtch.Start()");
cwtch.Start();
// Cwtch.start can take time, we don't want it blocking first splash screen draw, so postpone a smidge to let splash render
Future.delayed(const Duration(milliseconds: 50), () {
print("actually invoking cwtch.cwtch()!!!");
cwtch.Start();
LoadAssetThemes();
});
print("initState: starting connectivityListener");
if (EnvironmentConfig.TEST_MODE == false) {
startConnectivityListener();

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:cwtch/config.dart';
import 'package:flutter/widgets.dart';

View File

@ -5,6 +5,10 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
// hard coded fallback theme
// - Used if needed briefly at startup before themes loaded
// - Used as basis for other themes if they don't override all the colors
const cwtch_theme = "cwtch";
final Color darkGreyPurple = Color(0xFF281831);

View File

@ -1,89 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const ghost_theme = "ghost";
OpaqueThemeType GetGhostTheme(String mode) {
if (mode == mode_dark) {
return GhostDark();
} else {
return GhostLight();
}
}
class GhostDark extends CwtchDark {
static final Color darkBlue = Color(0xFF000051);
static final Color lightBlue = Color(0xFF1A237E);
static final Color background = Color(0xFF0D0D1F);
static final Color header = Color(0xFF0D0D1F);
static final Color userBubble = lightBlue;
static final Color peerBubble = darkBlue;
static final Color font = Colors.white;
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = lightBlue; //Color(0xFFD20070);
get theme => ghost_theme;
get mode => mode_dark;
get backgroundHilightElementColor => darkBlue;
get backgroundMainColor => background;
get backgroundPaneColor => header;
get defaultButtonColor => accent;
get dropShadowColor => GhostLight.darkBlue;
get mainTextColor => font;
get messageFromMeBackgroundColor => userBubble;
get messageFromMeTextColor => font;
get messageFromOtherBackgroundColor => peerBubble;
get messageFromOtherTextColor => font;
get scrollbarDefaultColor => lightBlue;
get sendHintTextColor => GhostLight.darkBlue;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings;
get topbarColor => header;
}
class GhostLight extends CwtchLight {
static final Color darkBlue = Color(0xFFAAB6FE);
static final Color lighterDarkBlue = Color(0xFFc3ccfe);
static final Color lightBlue = Color(0xFFE8EAF6);
static final Color background = Color(0xFFFDFDFF);
static final Color header = darkBlue;
static final Color userBubble = darkBlue;
static final Color peerBubble = lightBlue;
static final Color font = Color(0xFF0D0D1F);
static final Color settings = Color(0xFF0D0D1F);
static final Color accent = darkBlue;
get theme => ghost_theme;
get mode => mode_light;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background;
get backgroundPaneColor => background;
get defaultButtonColor => accent;
get defaultButtonActiveColor => lighterDarkBlue;
get defaultButtonDisabledColor => peerBubble;
get dropShadowColor => darkBlue;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble;
get messageFromMeTextColor => font;
get messageFromOtherBackgroundColor => peerBubble;
get messageFromOtherTextColor => font;
get portraitContactBadgeColor => accent;
get scrollbarDefaultColor => accent;
get sendHintTextColor => lightBlue;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings;
get topbarColor => header;
}

View File

@ -1,63 +0,0 @@
/// A theme dedicated to Juniper
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const juniper_theme = "juniper";
OpaqueThemeType GetJuniperTheme(String mode) {
// there is only one juniper theme
return Juniper();
}
class Juniper extends CwtchDark {
static final Color background = Color(0xFF1B1B1B);
static final Color backgroundAlt = Color(0xFF494949);
static final Color header = Color(0xFF1B1B1B);
static final Color userBubble = Color(0xFF373737);
static final Color peerBubble = Color(0xFF494949);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFF9E6A56);
static final Color accentAlt = Color(0xFF845A48);
get theme => juniper_theme;
get mode => mode_dark;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get topbarColor => header; //darkGreyPurple;
get mainTextColor => font; //whiteishPurple;
get defaultButtonColor => accent; //hotPink;
get textfieldHintColor => mainTextColor; //TODO pick
get toolbarIconColor => settings; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get backgroundHilightElementColor => accent;
get sendHintTextColor => accentAlt;
get hilightElementColor => accentAlt;
get defaultButtonTextColor => mainTextColor;
get defaultButtonDisabledColor => peerBubble;
get defaultButtonDisabledTextColor => peerBubble;
get textfieldErrorColor => accent;
get scrollbarDefaultColor => accent;
get portraitBackgroundColor => header;
get portraitOnlineBorderColor => font;
get portraitOfflineBorderColor => peerBubble;
get portraitBlockedBorderColor => peerBubble;
get portraitBlockedTextColor => peerBubble;
get portraitContactBadgeColor => accent;
get portraitContactBadgeTextColor => mainTextColor;
get portraitProfileBadgeColor => accent;
get portraitProfileBadgeTextColor => mainTextColor;
get dropShadowColor => accentAlt;
}

View File

@ -1,79 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const mermaid_theme = "mermaid";
OpaqueThemeType GetMermaidTheme(String mode) {
if (mode == mode_dark) {
return MermaidDark();
} else {
return MermaidLight();
}
}
class MermaidDark extends CwtchDark {
static final Color lavender = Color(0xFFB194C1);
static final Color background = Color(0xFF102426);
static final Color header = Color(0xFF102426);
static final Color userBubble = Color(0xFF00838F);
static final Color peerBubble = Color(0xFF00363A);
static final Color font = Colors.white;
static final Color settings = Color(0xFFF7FCFD);
static final Color accent = Color(0xFF8E64A5);
get theme => mermaid_theme;
get mode => mode_dark;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get dropShadowColor => lavender;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class MermaidLight extends CwtchLight {
static final Color background = Color(0xFFF7FCFD);
static final Color header = Color(0xFF56C8D8);
static final Color userBubble = Color(0xFF56C8D8);
static final Color peerBubble = Color(0xFFB2EBF2);
static final Color font = Color(0xFF102426);
static final Color settings = Color(0xFF102426);
static final Color accent = Color(0xFF8E64A5);
get theme => mermaid_theme;
get mode => mode_light;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get dropShadowColor => peerBubble;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

View File

@ -1,80 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const midnight_theme = "midnight";
OpaqueThemeType GetMidnightTheme(String mode) {
if (mode == mode_dark) {
return MidnightDark();
} else {
return MidnightLight();
}
}
class MidnightDark extends CwtchDark {
static final Color accentGray = Color(0xFFE0E0E0);
static final Color background = Color(0xFF1B1B1B);
static final Color backgroundAlt = Color(0xFF494949);
static final Color header = Color(0xFF1B1B1B);
static final Color userBubble = Color(0xFF373737);
static final Color peerBubble = Color(0xFF494949);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFD20070);
get theme => midnight_theme;
get mode => mode_dark;
get backgroundHilightElementColor => backgroundAlt;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get dropShadowColor => accentGray;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get scrollbarDefaultColor => accentGray;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class MidnightLight extends CwtchLight {
static final Color background = Color(0xFFFBFBFB); //Color(0xFFFFFDFF);
static final Color header = Color(0xFFE0E0E0);
static final Color userBubble = Color(0xFFE0E0E0);
static final Color peerBubble = Color(0xFFBABDBE);
static final Color font = Color(0xFF1B1B1B);
static final Color settings = Color(0xFF1B1B1B);
static final Color accent = Color(0xFFD20070);
get theme => midnight_theme;
get mode => mode_light;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get portraitOfflineBorderColor => peerBubble;
get portraitOnlineBorderColor => font;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

View File

@ -1,75 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const neon1_theme = "neon1";
OpaqueThemeType GetNeon1Theme(String mode) {
if (mode == mode_dark) {
return Neon1Dark();
} else {
return Neon1Light();
}
}
class Neon1Dark extends CwtchDark {
static final Color background = Color(0xFF290826);
static final Color header = Color(0xFF290826);
static final Color userBubble = Color(0xFFD20070);
static final Color peerBubble = Color(0xFF26A9A4);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFA604FE);
get theme => neon1_theme;
get mode => mode_dark;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get scrollbarDefaultColor => accent;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class Neon1Light extends CwtchLight {
static final Color background = Color(0xFFFFFDFF);
static final Color header = Color(0xFFFF94C2);
static final Color userBubble = Color(0xFFFF94C2);
static final Color peerBubble = Color(0xFFE7F6F6);
static final Color font = Color(0xFF290826);
static final Color settings = Color(0xFF290826);
static final Color accent = Color(0xFFA604FE);
get theme => neon1_theme;
get mode => mode_light;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get dropShadowColor => userBubble;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get portraitOfflineBorderColor => peerBubble;
get portraitOnlineBorderColor => font;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple
}

View File

@ -1,77 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const neon2_theme = "neon2";
OpaqueThemeType GetNeon2Theme(String mode) {
if (mode == mode_dark) {
return Neon2Dark();
} else {
return Neon2Light();
}
}
class Neon2Dark extends CwtchDark {
static final Color background = Color(0xFF290826);
static final Color header = Color(0xFF290826);
static final Color userBubble = Color(0xFFA604FE);
static final Color peerBubble = Color(0xFF03AD00);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFA604FE);
get theme => neon2_theme;
get mode => mode_dark;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get scrollbarDefaultColor => accent;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class Neon2Light extends CwtchLight {
static final Color paleGreen = Color(0xFFE7F6F6);
static final Color background = Color(0xFFFFFDFF);
static final Color header = Color(0xFFD8C7E1);
static final Color userBubble = Color(0xFFD8C7E1);
static final Color peerBubble = Color(0xFF80E27E);
static final Color font = Color(0xFF290826);
static final Color settings = Color(0xFF290826);
static final Color accent = Color(0xFFA604FE);
get theme => neon2_theme;
get mode => mode_light;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get dropShadowColor => userBubble;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get portraitOfflineBorderColor => peerBubble;
get portraitOnlineBorderColor => font;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => paleGreen;
get textfieldBorderColor => peerBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

View File

@ -3,20 +3,11 @@ import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/juniper.dart';
import 'package:cwtch/themes/mermaid.dart';
import 'package:cwtch/themes/neon1.dart';
import 'package:cwtch/themes/pumpkin.dart';
import 'package:cwtch/themes/vampire.dart';
import 'package:cwtch/themes/witch.dart';
import 'package:cwtch/themes/yamltheme.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/settings.dart';
import 'package:flutter/services.dart';
import 'ghost.dart';
import 'midnight.dart';
import 'neon2.dart';
const mode_light = "light";
const mode_dark = "dark";
@ -27,20 +18,13 @@ final TextStyle defaultTextStyle = TextStyle(fontFamily: "Inter", fontWeight: Fo
final TextStyle defaultTextButtonStyle = defaultTextStyle.copyWith(fontWeight: FontWeight.bold);
final TextStyle defaultDropDownMenuItemTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.bold, fontSize: 16);
final themes = {
cwtch_theme: {mode_light: CwtchLight(), mode_dark: CwtchDark()},
ghost_theme: {mode_light: GhostLight(), mode_dark: GhostDark()},
juniper_theme: {mode_light: Juniper(), mode_dark: Juniper()},
mermaid_theme: {mode_light: MermaidLight(), mode_dark: MermaidDark()},
midnight_theme: {mode_light: MidnightLight(), mode_dark: MidnightDark()},
neon1_theme: {mode_light: Neon1Light(), mode_dark: Neon1Dark()},
neon2_theme: {mode_light: Neon2Light(), mode_dark: Neon2Dark()},
pumpkin_theme: {mode_light: PumpkinLight(), mode_dark: PumpkinDark()},
vampire_theme: {mode_light: VampireLight(), mode_dark: VampireDark()},
witch_theme: {mode_light: WitchLight(), mode_dark: WitchDark()},
};
Map<String, Map<String, OpaqueThemeType>> themes = Map();
OpaqueThemeType getTheme(String themeId, String mode) {
LoadAssetThemes() async {
themes = await loadYamlThemes();
}
OpaqueThemeType getTheme(String themeId, String mode) {
if (themeId == "") {
themeId = cwtch_theme;
}
@ -53,10 +37,17 @@ OpaqueThemeType getTheme(String themeId, String mode) {
mode = mode_dark;
}
var theme = themes[themeId]?[mode];
var theme = themes[themeId]?[mode] ?? themes[themeId]?[flipMode(mode)];
return theme ?? CwtchDark();
}
String flipMode(String mode) {
if (mode == mode_dark) {
return mode_light;
}
return mode_dark;
}
Color lighten(Color color, [double amount = 0.15]) {
final hsl = HSLColor.fromColor(color);
final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));

View File

@ -1,70 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const pumpkin_theme = "pumpkin";
OpaqueThemeType GetPumpkinTheme(String mode) {
if (mode == mode_dark) {
return PumpkinDark();
} else {
return PumpkinLight();
}
}
class PumpkinDark extends CwtchDark {
static final Color background = Color(0xFF281831);
static final Color header = Color(0xFF281831);
static final Color userBubble = Color(0xFFB53D00);
static final Color peerBubble = Color(0xFF422850);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFFFBF6);
static final Color accent = Color(0xFF8E64A5);
get theme => pumpkin_theme;
get mode => mode_dark;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class PumpkinLight extends CwtchLight {
static final Color background = Color(0xFFFFFBF6);
static final Color header = Color(0xFFFF9800);
static final Color userBubble = Color(0xFFFF9800);
static final Color peerBubble = Color(0xFFD8C7E1);
static final Color font = Color(0xFF281831);
static final Color settings = Color(0xFF281831);
static final Color accent = Color(0xFF8E64A5);
get theme => pumpkin_theme;
get mode => mode_light;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get dropShadowColor => peerBubble;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get scrollbarDefaultColor => accent;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

View File

@ -1,73 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const vampire_theme = "vampire";
OpaqueThemeType GetVampireTheme(String mode) {
if (mode == mode_dark) {
return VampireDark();
} else {
return VampireLight();
}
}
class VampireDark extends CwtchDark {
static final Color background = Color(0xFF281831);
static final Color header = Color(0xFF281831);
static final Color userBubble = Color(0xFF9A1218);
static final Color peerBubble = Color(0xFF422850);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = Color(0xFF8E64A5);
get theme => vampire_theme;
get mode => mode_dark;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get scrollbarDefaultColor => accent;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class VampireLight extends CwtchLight {
static final Color background = Color(0xFFFFFDFD);
static final Color header = Color(0xFFD8C7E1);
static final Color userBubble = Color(0xFFD8C7E1);
static final Color peerBubble = Color(0xFFFFEBEE);
static final Color font = Color(0xFF281831);
static final Color settings = Color(0xFF281831);
static final Color accent = Color(0xFF8E64A5);
get theme => vampire_theme;
get mode => mode_light;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get dropShadowColor => userBubble;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

View File

@ -1,76 +0,0 @@
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'opaque.dart';
const witch_theme = "witch";
OpaqueThemeType GetWitchTheme(String mode) {
if (mode == mode_dark) {
return WitchDark();
} else {
return WitchLight();
}
}
class WitchDark extends CwtchDark {
static final Color background = Color(0xFF0E1E0E);
static final Color header = Color(0xFF0E1E0E);
static final Color userBubble = Color(0xFF1B5E20);
static final Color peerBubble = Color(0xFF003300);
static final Color font = Color(0xFFFFFFFF);
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = Color(0xFFD20070);
get theme => witch_theme;
get mode => mode_dark;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background; // darkGreyPurple;
get backgroundPaneColor => header; //darkGreyPurple;
get defaultButtonColor => accent; //hotPink;
get mainTextColor => font; //whiteishPurple;
get messageFromMeBackgroundColor => userBubble; // mauvePurple;
get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => mainTextColor;
get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple;
}
class WitchLight extends CwtchLight {
static final Color background = Color(0xFFFDFFFD);
static final Color header = Color(0xFF80E27E);
static final Color userBubble = Color(0xFF80E27E);
static final Color peerBubble = Color(0xFFE8F5E9);
static final Color font = Color(0xFF0E1E0E);
static final Color settings = Color(0xFF0E1E0E);
static final Color accent = Color(0xFFD20070);
get theme => witch_theme;
get mode => mode_light;
get backgroundHilightElementColor => peerBubble;
get backgroundMainColor => background; //whitePurple;
get backgroundPaneColor => background; //whitePurple;
get defaultButtonColor => accent; // hotPink;
get mainTextColor => settings;
get messageFromMeBackgroundColor => userBubble; //brightPurple;
get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple;
get portraitContactBadgeColor => accent;
get scrollbarDefaultColor => accent;
get textfieldBackgroundColor => peerBubble;
get textfieldBorderColor => userBubble;
get textfieldHintColor => font;
get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple;
}

126
lib/themes/yamltheme.dart Normal file
View File

@ -0,0 +1,126 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/services.dart';
import 'package:yaml/yaml.dart';
Future<Map<String, Map<String, OpaqueThemeType>>> loadYamlThemes() async {
final manifestJson = await rootBundle.loadString('AssetManifest.json');
final themesList = json.decode(manifestJson).keys.where((String key) => key.startsWith('assets/themes'));
Map<String, Map<String, OpaqueThemeType>> themes = Map();
for (String themefile in themesList) {
if (themefile.substring(themefile.length-4) != ".yml") {
continue;
}
try {
var data = await loadYamlTheme(themefile);
if (data != null) {
// remove "assets/themes" and ".yml" from name
themes[themefile.substring(14, themefile.length - 4)] = data;
}
} catch (e) {
print("Failed to load theme: $themefile with exception: $e");
}
}
return themes;
}
Future<YamlMap?> readAssetYamlTheme(String themefile) async {
print("loading theme: $themefile...");
final contents = await rootBundle.loadString(themefile);
return loadYaml(contents);
}
Future<Map<String, OpaqueThemeType>?> loadYamlTheme(String themefile) async {
final yml = await readAssetYamlTheme(themefile);
if (yml == null) {
print("failed to load theme: $themefile");
return null;
}
Map<String, OpaqueThemeType> subthemes = Map();
if ((yml["themes"] as YamlMap).containsKey(mode_dark)) {
subthemes[mode_dark] = YmlTheme(yml, yml["themes"]["name"], mode_dark);
}
if ((yml["themes"] as YamlMap).containsKey(mode_light)) {
subthemes[mode_light] = YmlTheme(yml, yml["themes"]["name"], mode_light);
}
return subthemes;
}
class YmlTheme extends OpaqueThemeType {
late YamlMap yml;
late String mode;
late String theme;
late OpaqueThemeType fallbackTheme;
YmlTheme(YamlMap yml, theme, mode) {
this.yml = yml;
this.theme = theme;
this.mode = mode;
if (mode == mode_dark) {
fallbackTheme = CwtchDark();
} else {
fallbackTheme = CwtchLight();
}
}
Color? getColor(String name) {
var val = yml["themes"][mode]["theme"][name];
if (! (val is int)) {
val = yml["themes"][mode]["theme"][val] ?? val;
}
if (! (val is int)) {
val = yml["themes"][mode]?["colors"][val] ?? val;
}
if (! (val is int)) {
val = yml["colors"]?[val];
}
if (! (val is int)) {
return null;
}
return Color(0xFF000000 + val as int);
}
get backgroundMainColor => getColor("backgroundMainColor") ?? fallbackTheme.backgroundMainColor;
get backgroundPaneColor => getColor("backgroundPaneColor") ?? fallbackTheme.backgroundPaneColor;
get topbarColor => getColor("topbarColor") ?? fallbackTheme.topbarColor;
get mainTextColor => getColor("mainTextColor") ?? fallbackTheme.mainTextColor;
get hilightElementColor => getColor("hilightElementColor") ?? fallbackTheme.hilightElementColor;
get backgroundHilightElementColor => getColor("backgroundHilightElementColor") ?? fallbackTheme.backgroundHilightElementColor;
get sendHintTextColor => getColor("sendHintTextColor") ?? fallbackTheme.sendHintTextColor;
get defaultButtonColor => getColor("defaultButtonColor") ?? fallbackTheme.defaultButtonColor;
get defaultButtonActiveColor => /*mode == mode_light ? darken(defaultButtonColor) :*/ lighten(getColor("defaultButtonColor") ?? fallbackTheme.defaultButtonColor);
get defaultButtonTextColor => getColor("defaultButtonTextColor") ?? fallbackTheme.defaultButtonTextColor;
get defaultButtonDisabledColor => getColor("defaultButtonDisabledColor") ?? fallbackTheme.defaultButtonDisabledColor;
get textfieldBackgroundColor => getColor("textfieldBackgroundColor") ?? fallbackTheme.textfieldBackgroundColor;
get textfieldBorderColor => getColor("textfieldBorderColor") ?? fallbackTheme.textfieldBorderColor;
get textfieldHintColor => getColor("textfieldHintColor") ?? fallbackTheme.textfieldHintColor;
get textfieldErrorColor => getColor("textfieldErrorColor") ?? fallbackTheme.textfieldErrorColor;
get scrollbarDefaultColor => getColor("scrollbarDefaultColor") ?? fallbackTheme.scrollbarDefaultColor;
get portraitBackgroundColor => getColor("portraitBackgroundColor") ?? fallbackTheme.portraitBackgroundColor;
get portraitOnlineBorderColor => getColor("portraitOnlineBorderColor") ?? fallbackTheme.portraitOnlineBorderColor;
get portraitOfflineBorderColor => getColor("portraitOfflineBorderColor") ?? fallbackTheme.portraitOfflineBorderColor;
get portraitBlockedBorderColor => getColor("portraitBlockedBorderColor") ?? fallbackTheme.portraitBlockedBorderColor;
get portraitBlockedTextColor => getColor("portraitBlockedTextColor") ?? fallbackTheme.portraitBlockedTextColor;
get portraitContactBadgeColor => getColor("portraitContactBadgeColor") ?? fallbackTheme.portraitContactBadgeColor;
get portraitContactBadgeTextColor => getColor("portraitContactBadgeTextColor") ?? fallbackTheme.portraitContactBadgeTextColor;
get portraitProfileBadgeColor => getColor("portraitProfileBadgeColor") ?? fallbackTheme.portraitProfileBadgeColor;
get portraitProfileBadgeTextColor => getColor("portraitProfileBadgeTextColor") ?? fallbackTheme.portraitProfileBadgeTextColor;
get portraitOnlineAwayColor => Color(0xFFFFF59D) ?? fallbackTheme.portraitOnlineAwayColor;
get portraitOnlineBusyColor => Color(0xFFEF9A9A) ?? fallbackTheme.portraitOnlineBusyColor;
get dropShadowColor => getColor("dropShadowColor") ?? fallbackTheme.dropShadowColor;
get toolbarIconColor => getColor("toolbarIconColor") ?? fallbackTheme.toolbarIconColor;
get messageFromMeBackgroundColor => getColor("messageFromMeBackgroundColor") ?? fallbackTheme.messageFromMeBackgroundColor;
get messageFromMeTextColor => getColor("messageFromMeTextColor") ?? fallbackTheme.messageFromMeTextColor;
get messageFromOtherBackgroundColor => getColor("messageFromOtherBackgroundColor") ?? fallbackTheme.messageFromOtherBackgroundColor;
get messageFromOtherTextColor => getColor("messageFromOtherTextColor") ?? fallbackTheme.messageFromOtherTextColor;
}

View File

@ -3,18 +3,9 @@ import 'dart:convert';
import 'dart:io';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/themes/juniper.dart';
import 'package:cwtch/widgets/folderpicker.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/ghost.dart';
import 'package:cwtch/themes/mermaid.dart';
import 'package:cwtch/themes/midnight.dart';
import 'package:cwtch/themes/neon1.dart';
import 'package:cwtch/themes/neon2.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/themes/pumpkin.dart';
import 'package:cwtch/themes/vampire.dart';
import 'package:cwtch/themes/witch.dart';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
@ -809,23 +800,23 @@ String getThemeName(context, String theme) {
switch (theme) {
case cwtch_theme:
return AppLocalizations.of(context)!.themeNameCwtch;
case ghost_theme:
case "ghost":
return AppLocalizations.of(context)!.themeNameGhost;
case mermaid_theme:
case "mermaid":
return AppLocalizations.of(context)!.themeNameMermaid;
case midnight_theme:
case "midnight":
return AppLocalizations.of(context)!.themeNameMidnight;
case neon1_theme:
case "neon1":
return AppLocalizations.of(context)!.themeNameNeon1;
case neon2_theme:
case "neon2":
return AppLocalizations.of(context)!.themeNameNeon2;
case pumpkin_theme:
case "pumpkin":
return AppLocalizations.of(context)!.themeNamePumpkin;
case vampire_theme:
case "vampire":
return AppLocalizations.of(context)!.themeNameVampire;
case witch_theme:
case "witch":
return AppLocalizations.of(context)!.themeNameWitch;
case juniper_theme:
case "juniper":
return "Juniper"; // Juniper is a noun, and doesn't get subject to translation...
}
return theme;

View File

@ -43,6 +43,7 @@ dependencies:
file_picker: 5.2.11
url_launcher: ^6.0.18
window_manager: ^0.3.2
yaml: ^3.1.2
# notification plugins
## Somewhere between 0.0.2 and 0.3 they introduced a dependancy on a new Windows RT feature
## Which can only be linked to with a new VC 17 compiler and we're suspicious only work on
@ -105,6 +106,7 @@ flutter:
- assets/core/
- assets/profiles/
- assets/servers/
- assets/themes/
fonts:
- family: Cwtch