Add customization of text color close #385

This commit is contained in:
Thomas Ricouard 2023-03-03 08:12:01 +01:00
parent 10eeb39241
commit eea6d93dd5
26 changed files with 40 additions and 1 deletions

View file

@ -18,6 +18,7 @@ struct DisplaySettingsView: View {
@State private var localTintColor = Theme.shared.tintColor
@State private var localPrimaryBackgroundColor = Theme.shared.primaryBackgroundColor
@State private var localSecondaryBackgroundColor = Theme.shared.secondaryBackgroundColor
@State private var localLabelColor = Theme.shared.labelColor
private var previewStatusViewModel = StatusRowViewModel(status: Status.placeholder(forSettings: true, language: "la"),
client: Client(server: ""),
@ -36,6 +37,7 @@ struct DisplaySettingsView: View {
ColorPicker("settings.display.theme.tint", selection: $localTintColor)
ColorPicker("settings.display.theme.background", selection: $localPrimaryBackgroundColor)
ColorPicker("settings.display.theme.secondary-background", selection: $localSecondaryBackgroundColor)
ColorPicker("settings.display.theme.text-color", selection: $localLabelColor)
}
.disabled(theme.followSystemColorScheme)
.opacity(theme.followSystemColorScheme ? 0.5 : 1.0)
@ -48,12 +50,22 @@ struct DisplaySettingsView: View {
.onChange(of: localPrimaryBackgroundColor) { _ in
didChangeColors = true
}
.onChange(of: localLabelColor) { _ in
didChangeColors = true
}
.onChange(of: theme.selectedSet) { _ in
localTintColor = theme.tintColor
localPrimaryBackgroundColor = theme.primaryBackgroundColor
localSecondaryBackgroundColor = theme.secondaryBackgroundColor
localLabelColor = theme.labelColor
}
if didChangeColors {
Button {
didChangeColors = false
theme.tintColor = localTintColor
theme.primaryBackgroundColor = localPrimaryBackgroundColor
theme.secondaryBackgroundColor = localSecondaryBackgroundColor
theme.labelColor = localLabelColor
} label: {
Text("settings.display.colors.apply")
}
@ -160,6 +172,7 @@ struct DisplaySettingsView: View {
localTintColor = theme.tintColor
localPrimaryBackgroundColor = theme.primaryBackgroundColor
localSecondaryBackgroundColor = theme.secondaryBackgroundColor
localLabelColor = theme.labelColor
} label: {
Text("settings.display.restore")

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "Паказаць кнопку перакладу";
"settings.display.theme.background" = "Колер фону";
"settings.display.theme.secondary-background" = "Другасны колер фону";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Колер адцення";
"settings.display.theme.systemColor" = "Згодна з сістэмай";
"settings.general.browser" = "Браўзэр";

View file

@ -85,6 +85,7 @@
"settings.display.translate-button" = "Mostra el botó de traducció";
"settings.display.theme.background" = "Color de fons";
"settings.display.theme.secondary-background" = "Color de fons secundari";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Color del tint";
"settings.display.theme.systemColor" = "Sincronitza amb els colors del sistema";
"settings.general.browser" = "Navegador";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Übersetzen-Button anzeigen";
"settings.display.theme.background" = "Hintergrundfarbe";
"settings.display.theme.secondary-background" = "Sekundäre Hintergrundfarbe";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Akzentfarbe";
"settings.display.theme.systemColor" = "Systemeinstellung verwenden";
"settings.general.browser" = "Browser";

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "Show Translate Button";
"settings.display.theme.background" = "Background Colour";
"settings.display.theme.secondary-background" = "Secondary Background Colour";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Tint Colour";
"settings.display.theme.systemColor" = "Match System";
"settings.general.browser" = "Browser";

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "Show Translate Button";
"settings.display.theme.background" = "Background Color";
"settings.display.theme.secondary-background" = "Secondary Background Color";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Tint Color";
"settings.display.theme.systemColor" = "Match System";
"settings.general.browser" = "Browser";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Mostrar botón para traducir";
"settings.display.theme.background" = "Color de fondo";
"settings.display.theme.secondary-background" = "Color de fondo secundario";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Color";
"settings.display.theme.systemColor" = "Sistema de coincidencia";
"settings.general.browser" = "Navegador";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Erakutsi itzulpen botoia";
"settings.display.theme.background" = "Hondoaren kolorea";
"settings.display.theme.secondary-background" = "Bigarren mailako hondoaren kolorea";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Tonua";
"settings.display.theme.systemColor" = "Sistemak darabilena";
"settings.general.browser" = "Nabigatzailea";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Afficher le bouton de traduction";
"settings.display.theme.background" = "Couleur de fond";
"settings.display.theme.secondary-background" = "Couleur de fond secondaire";
"settings.display.theme.text-color" = "Couleur du texte";
"settings.display.theme.tint" = "Couleur de teinte";
"settings.display.theme.systemColor" = "Correspondre au système";
"settings.general.browser" = "Navigateur";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Mostra bottone per la traduzione";
"settings.display.theme.background" = "Colore di sfondo";
"settings.display.theme.secondary-background" = "Colore di sfondo secondario";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Colore";
"settings.display.theme.systemColor" = "Utilizza le impostazioni di sistema";
"settings.general.browser" = "Browser";

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "翻訳ボタンの表示";
"settings.display.theme.background" = "バックグラウンドカラー";
"settings.display.theme.secondary-background" = "アクセントカラー";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "色合い";
"settings.display.theme.systemColor" = "システムに合わせる";
"settings.general.browser" = "ブラウザ";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "번역 버튼 표시";
"settings.display.theme.background" = "배경 색상";
"settings.display.theme.secondary-background" = "보조 배경 색상";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "강조 색상";
"settings.display.theme.systemColor" = "시스템 설정에 맞춤";
"settings.general.browser" = "브라우저";

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "Vis oversettelsesknapp";
"settings.display.theme.background" = "Bakgrunnsfarge";
"settings.display.theme.secondary-background" = "Sekundær bakgrunnsfarge";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Temafarge";
"settings.display.theme.systemColor" = "Match system";
"settings.general.browser" = "Nettleser";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Toon vertaalknop";
"settings.display.theme.background" = "Achtergrondkleur";
"settings.display.theme.secondary-background" = "Secundaire achtergrondkleur";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Kleurtint";
"settings.display.theme.systemColor" = "Automatisch";
"settings.general.browser" = "Browser";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Pokazuj przycisk tłumaczenia";
"settings.display.theme.background" = "Kolor tła";
"settings.display.theme.secondary-background" = "Dodatkowy kolor tła";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Kolor wiodący";
"settings.display.theme.systemColor" = "Zgodny z systemowym";
"settings.general.browser" = "Przeglądarka";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Exibir botão de tradução";
"settings.display.theme.background" = "Cor de fundo";
"settings.display.theme.secondary-background" = "Cor de fundo secundária";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Cor principal";
"settings.display.theme.systemColor" = "Padrão do Sistema";
"settings.general.browser" = "Navegador";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "Çeviri Butonunu Göster";
"settings.display.theme.background" = "Arka Plan Rengi";
"settings.display.theme.secondary-background" = "İkincil Arka Plan Rengi";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Tonlama Rengi";
"settings.display.theme.systemColor" = "Eşleştirme Sistemi";
"settings.general.browser" = "Tarayıcı";

View file

@ -90,6 +90,7 @@
"settings.display.translate-button" = "Відображати кнопку перекладу";
"settings.display.theme.background" = "Колір фону";
"settings.display.theme.secondary-background" = "Додатковий колір фону";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "Відтінок кольору";
"settings.display.theme.systemColor" = "Відповідати системній темі";
"settings.general.browser" = "Браузер";

View file

@ -86,6 +86,7 @@
"settings.display.translate-button" = "显示翻译按钮";
"settings.display.theme.background" = "背景颜色";
"settings.display.theme.secondary-background" = "二级背景颜色";
"settings.display.theme.text-color" = "Text Color";
"settings.display.theme.tint" = "色调";
"settings.display.theme.systemColor" = "匹配系统";
"settings.general.browser" = "默认浏览器";

View file

@ -145,6 +145,7 @@ struct AccountDetailHeaderView: View {
HStack(alignment: .center, spacing: 2) {
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
.font(.scaledHeadline)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledHeadlinePointSize)
if account.bot {
Text(Image(systemName: "poweroutlet.type.b.fill"))
@ -190,6 +191,7 @@ struct AccountDetailHeaderView: View {
EmojiTextApp(account.note, emojis: account.emojis)
.font(.scaledBody)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledBodyPointSize)
.padding(.top, 8)
.textSelection(.enabled)

View file

@ -76,6 +76,7 @@ public struct ConversationDetailView: View {
{
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
.font(.scaledHeadline)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledHeadlinePointSize)
} else {
Text("Direct message with \(viewModel.conversation.accounts.count) people")

View file

@ -33,6 +33,7 @@ struct ConversationMessageView: View {
VStack(alignment: .leading) {
EmojiTextApp(message.content, emojis: message.emojis)
.font(.scaledBody)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledBodyPointSize)
.padding(6)
.environment(\.openURL, OpenURLAction { url in

View file

@ -23,6 +23,7 @@ struct ConversationsListRow: View {
EmojiTextApp(.init(stringValue: conversation.accounts.map { $0.safeDisplayName }.joined(separator: ", ")),
emojis: conversation.accounts.flatMap { $0.emojis })
.font(.scaledSubheadline)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledSubheadlinePointSize)
.fontWeight(.semibold)
.foregroundColor(theme.labelColor)
@ -41,6 +42,7 @@ struct ConversationsListRow: View {
EmojiTextApp(conversation.lastStatus?.content ?? HTMLString(stringValue: ""), emojis: conversation.lastStatus?.emojis ?? [])
.multilineTextAlignment(.leading)
.font(.scaledBody)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledBodyPointSize)
}
Spacer()

View file

@ -283,7 +283,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
private func processText() {
guard markedTextRange == nil else { return }
statusText.addAttributes([.foregroundColor: UIColor(Color.label),
statusText.addAttributes([.foregroundColor: UIColor(Theme.shared.labelColor),
.font: Font.scaledBodyUIFont,
.backgroundColor: UIColor.clear,
.underlineColor: UIColor.clear],

View file

@ -39,6 +39,7 @@ struct StatusRowHeaderView: View {
EmojiTextApp(.init(stringValue: viewModel.finalStatus.account.safeDisplayName),
emojis: viewModel.finalStatus.account.emojis)
.font(.scaledSubheadline)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledSubheadlinePointSize)
.fontWeight(.semibold)
.lineLimit(1)

View file

@ -17,6 +17,7 @@ struct StatusRowTextView: View {
language: viewModel.finalStatus.language,
lineLimit: viewModel.lineLimit)
.font(.scaledBody)
.foregroundColor(theme.labelColor)
.emojiSize(Font.scaledBodyPointSize)
.environment(\.openURL, OpenURLAction { url in
viewModel.routerPath.handleStatus(status: viewModel.finalStatus, url: url)