Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Dark Theme #1017

Merged
merged 144 commits into from Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
bcabdca
Stylesheets
TheAutisticTechie May 13, 2021
e6d7c52
Theme Configuration
TheAutisticTechie May 13, 2021
b9b639c
Options Area
TheAutisticTechie May 13, 2021
98add0d
swal2 style
TheAutisticTechie May 13, 2021
703af05
Icon styling
TheAutisticTechie May 13, 2021
6d1f3be
Fix theme not saving
TheAutisticTechie May 13, 2021
ecb6c9f
Update English
TheAutisticTechie May 13, 2021
cbd74be
Update messages.json
TheAutisticTechie May 13, 2021
1533b57
Login logo
TheAutisticTechie May 14, 2021
67e046f
dropdown and login logo
TheAutisticTechie May 14, 2021
454ec13
btn-link and totp fix
TheAutisticTechie May 14, 2021
da579d2
Organisation Styling
TheAutisticTechie May 14, 2021
d8fdcd7
Update messages.json
TheAutisticTechie May 19, 2021
9bb5083
Sync Latest Version
TheAutisticTechie May 19, 2021
eef6214
Merge pull request #2 from dltmurphy/bitwarden-master
TheAutisticTechie May 19, 2021
c2406ae
Merge branch 'bitwarden:master' into master
TheAutisticTechie May 25, 2021
c0fe0d4
Update webauthn-fallback.ts
TheAutisticTechie May 25, 2021
76e8011
Merge pull request #3 from dltmurphy/webauth-fallback
TheAutisticTechie May 25, 2021
d86578c
Fix contrast issues
TheAutisticTechie May 25, 2021
bdae03b
Add Paypal Container and Loading svg file
TheAutisticTechie May 25, 2021
c652d39
Update jslib
TheAutisticTechie May 25, 2021
92dd918
Merge branch 'master' of https://github.com/bitwarden/web into bitwar…
TheAutisticTechie May 25, 2021
53556cc
Merge branch 'bitwarden-master'
TheAutisticTechie May 25, 2021
2ed585e
Password Generator contrast fix
TheAutisticTechie May 25, 2021
a38fac1
Merge branch 'bitwarden:master' into master
TheAutisticTechie May 26, 2021
3ecc999
Merge branch 'bitwarden:master' into master
TheAutisticTechie May 26, 2021
d8ade00
Merge branch 'bitwarden:master' into master
TheAutisticTechie May 27, 2021
aeffcb3
Merge branch 'bitwarden:master' into master
TheAutisticTechie May 28, 2021
8979eb5
Merge branch 'master' of https://github.com/dltmurphy/web
TheAutisticTechie Jun 3, 2021
9c280af
Fix light theme
TheAutisticTechie Jun 3, 2021
3706629
Dark Mode Fix buttons and foreground
TheAutisticTechie Jun 4, 2021
3377cbe
Fix button hover
TheAutisticTechie Jun 4, 2021
a9d12dd
Rebase
TheAutisticTechie Jun 7, 2021
9d2f194
Merge branch 'bitwarden-master'
TheAutisticTechie Jun 7, 2021
3789e15
Fix Styles after rebase
TheAutisticTechie Jun 7, 2021
f6cbfe9
Class Underscores
TheAutisticTechie Jun 7, 2021
66fa847
Add hover on nav dropdown-item
TheAutisticTechie Jun 7, 2021
ea1578e
Table hover
TheAutisticTechie Jun 7, 2021
ad3d6a8
Merge branch 'master' of https://github.com/bitwarden/web
TheAutisticTechie Jun 7, 2021
67d2e4f
Fix my rebase issue with obj array
TheAutisticTechie Jun 8, 2021
024d1f2
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 9, 2021
e21bcf7
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 10, 2021
1c4f76f
Init styling
TheAutisticTechie Jun 11, 2021
d73450a
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 11, 2021
4b0bc73
Update Theme Settings
TheAutisticTechie Jun 11, 2021
3c47b4b
Resolve deprecation
TheAutisticTechie Jun 15, 2021
5974eb1
Update jslib
TheAutisticTechie Jun 16, 2021
96b740a
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 16, 2021
df8be13
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 28, 2021
a4d51a7
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jun 29, 2021
8366696
Disable Theme Preview
TheAutisticTechie Jun 30, 2021
6ac8a9d
Update messages.json
TheAutisticTechie Jun 30, 2021
105b7f8
Options Fix for Default Theme Changes
TheAutisticTechie Jun 30, 2021
03d1741
Updated Colour Scheme
TheAutisticTechie Jun 30, 2021
83a2bbd
Toast fix
TheAutisticTechie Jun 30, 2021
ff17686
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jul 2, 2021
6605e01
Button and Text Styling
TheAutisticTechie Jul 4, 2021
7fe20d4
Options Update and Messages Fix
TheAutisticTechie Jul 6, 2021
e84b3ab
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jul 8, 2021
d0278b4
Tidy Up Stylesheet
TheAutisticTechie Jul 8, 2021
3ad6215
Added Search Icon and Fixed Callout styling
TheAutisticTechie Jul 12, 2021
c0ebe77
Update styles.scss
TheAutisticTechie Jul 12, 2021
2fdba9a
Add theme styling to Stripe
TheAutisticTechie Jul 12, 2021
f958cac
Refactor logic for setting color
eliykat Jul 15, 2021
ed8f7fb
Reorder logic to avoid race condition
eliykat Jul 15, 2021
8cd8fd2
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jul 19, 2021
face31e
Merge branch 'master' of https://github.com/bitwarden/web
TheAutisticTechie Jul 21, 2021
9751ce1
PayPal Loading and Misc Fix
TheAutisticTechie Jul 22, 2021
15941b8
text-state bug fix
TheAutisticTechie Jul 22, 2021
fa0e627
Badge Colour Fix
TheAutisticTechie Jul 22, 2021
a1fdd51
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jul 25, 2021
57fe265
Remove PayPal Tagline
TheAutisticTechie Jul 26, 2021
fb42a4d
Merge branch 'master' of https://github.com/dltmurphy/web
TheAutisticTechie Jul 26, 2021
3839a30
Merge branch 'bitwarden:master' into master
TheAutisticTechie Jul 27, 2021
2efa5d1
Update .gitignore
TheAutisticTechie Jul 27, 2021
573c24a
Add Missing Final New Line
TheAutisticTechie Aug 5, 2021
9f3e728
Revert Search Icon
TheAutisticTechie Aug 5, 2021
2d98549
img size and sso img div
TheAutisticTechie Aug 5, 2021
0311f90
Register Enterprise Styling
TheAutisticTechie Aug 6, 2021
c13834c
Splitting the styles.scss up
TheAutisticTechie Aug 6, 2021
cbc119f
Merge branch 'master' of https://github.com/bitwarden/web into bitwar…
TheAutisticTechie Aug 7, 2021
3778537
Merge branch 'bitwarden-master'
TheAutisticTechie Aug 7, 2021
6286e23
Rebase package-lock.json
TheAutisticTechie Aug 9, 2021
dffbe1d
Merge branch 'bitwarden:master' into master
TheAutisticTechie Aug 13, 2021
1ce0f2c
Adding the Styling from #1131
TheAutisticTechie Aug 20, 2021
683c4b7
Merge branch 'master' of git://github.com/bitwarden/web into bitwarde…
TheAutisticTechie Sep 1, 2021
ad2db9a
Merge branch 'bitwarden-master'
TheAutisticTechie Sep 1, 2021
62283e8
Splitting Styles
TheAutisticTechie Sep 1, 2021
9efe548
Update to New Design
TheAutisticTechie Sep 4, 2021
2ef2d3c
Merge branch 'bitwarden:master' into master
TheAutisticTechie Sep 5, 2021
88bd12a
Form and Nav restyle
TheAutisticTechie Sep 5, 2021
b58188b
Merge branch 'master' of https://github.com/dltmurphy/web
TheAutisticTechie Sep 5, 2021
c141d99
Modal Opacity and Callout
TheAutisticTechie Sep 5, 2021
b61494b
Nav Colours
TheAutisticTechie Sep 6, 2021
cd73d8a
Missing Borders
TheAutisticTechie Sep 7, 2021
1e4faa0
Light theme fix
TheAutisticTechie Sep 7, 2021
9045eb1
Improved border for listgroup
TheAutisticTechie Sep 8, 2021
65da67c
Change Org Nav Colour
TheAutisticTechie Sep 8, 2021
6be379e
Delete .dccache
TheAutisticTechie Sep 10, 2021
5ebb185
Fix whitespace and class removal
TheAutisticTechie Sep 11, 2021
711339a
Improve listener for system changes
TheAutisticTechie Sep 13, 2021
9b91a36
lint fix
TheAutisticTechie Sep 13, 2021
30c9a3a
Themed Image Component
TheAutisticTechie Sep 13, 2021
6c4b970
Update themedimagecomponent
TheAutisticTechie Sep 14, 2021
71d81da
index.html image script
TheAutisticTechie Sep 14, 2021
b78ae0e
Update index.html
TheAutisticTechie Sep 14, 2021
e8324b6
image updates
TheAutisticTechie Sep 14, 2021
21d2e25
Finish off themed-image.component
eliykat Sep 15, 2021
5d26764
Use ConstantsService key instead of string literal
eliykat Sep 15, 2021
ba21627
Save theme to localStorage for persistence
eliykat Sep 15, 2021
6c1d5c2
Undo change to Wired image
eliykat Sep 15, 2021
4476b05
!Important removal and tweaks
TheAutisticTechie Sep 15, 2021
85daf42
Add exemption for enterprise2
TheAutisticTechie Sep 17, 2021
c5ee4dd
Fix Casing
TheAutisticTechie Sep 19, 2021
9c1a188
Removed Unused Pending from previous design
TheAutisticTechie Sep 19, 2021
cc77e6f
Fix regression with navbar
TheAutisticTechie Sep 19, 2021
71eb496
Fix regression with navbar
TheAutisticTechie Sep 19, 2021
7145fa8
Mostly Revert Bad Idea
TheAutisticTechie Sep 20, 2021
ac58966
Light theme by default
TheAutisticTechie Sep 21, 2021
8729d39
Fix light theme by default changes
eliykat Sep 22, 2021
037021f
Refactor to use getEffectiveTheme
eliykat Sep 22, 2021
18fcfb4
Tidy up logic for themed-image
eliykat Sep 22, 2021
e669592
Refactor theme constants to use enum
eliykat Sep 22, 2021
0847ea9
Merge branch 'master' into dltmurphy-darkmode
eliykat Sep 22, 2021
1d73d04
Undo changes to enterprise registration page
eliykat Sep 22, 2021
2ef950c
Undo changes to registration component
eliykat Sep 22, 2021
f774e8d
Misc style fixes and cleanup
eliykat Sep 22, 2021
bc8ac27
Set theme in index.html before app loads
eliykat Sep 22, 2021
f2cf91c
Revert change to SVG %23
TheAutisticTechie Sep 22, 2021
86c3a42
Fix index.html theming
eliykat Sep 23, 2021
eab266c
Merge branch 'master' of https://github.com/dltmurphy/web into dltmur…
eliykat Sep 23, 2021
47bbe3f
Reorder scss
eliykat Sep 23, 2021
92a2c7f
Restructure scss files
eliykat Sep 23, 2021
7cd9e26
Undo changes to .gitignore
eliykat Sep 27, 2021
1b83828
Remove magic numbers
eliykat Sep 28, 2021
c2eac78
Merge branch 'master' into dltmurphy-darkmode
eliykat Sep 28, 2021
f323db8
Use scss selector to set logo image
eliykat Sep 28, 2021
8cb0cd5
Remove themed-image
eliykat Sep 28, 2021
03572f6
Set initial theme in index.html only, tweak logic
eliykat Sep 28, 2021
677d19b
Export Sass to TS
TheAutisticTechie Sep 28, 2021
1e5858b
Update input vars for dark theme
TheAutisticTechie Sep 28, 2021
b2053aa
Use theme enum
eliykat Sep 29, 2021
6134c3b
Update jslib
eliykat Sep 29, 2021
34d934e
Merge branch 'master' into dltmurphy-darkmode
eliykat Sep 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,6 @@
<div class="mt-5 d-flex justify-content-center" *ngIf="loading">
<div>
<img src="/src/images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<img class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span class="sr-only">{{'loading' | i18n}}</span>
Expand Down
@@ -1,6 +1,6 @@
<div class="mt-5 d-flex justify-content-center" *ngIf="loading">
<div>
<img src="/src/images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<img class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span class="sr-only">{{'loading' | i18n}}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/accounts/accept-emergency.component.html
@@ -1,6 +1,6 @@
<div class="mt-5 d-flex justify-content-center" *ngIf="loading">
<div>
<img src="../../images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<img class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span class="sr-only">{{'loading' | i18n}}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/accounts/login.component.html
@@ -1,7 +1,7 @@
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" class="container" ngNativeValidate>
<div class="row justify-content-md-center mt-5">
<div class="col-5">
<img src="../../images/logo-dark@2x.png" class="logo mb-2" alt="Bitwarden">
Hinton marked this conversation as resolved.
Show resolved Hide resolved
<img class="mb-2 logo" alt="Bitwarden">
<p class="lead text-center mx-4 mb-4">{{'loginOrCreateNewAccount' | i18n}}</p>
<div class="card d-block">
<div class="card-body">
Expand Down
2 changes: 1 addition & 1 deletion src/app/accounts/sso.component.html
@@ -1,7 +1,7 @@
<form #form (ngSubmit)="submit()" class="container" [appApiAction]="initiateSsoFormPromise" ngNativeValidate>
<div class="row justify-content-md-center mt-5">
<div class="col-5">
<img src="../../images/logo-dark@2x.png" class="logo mb-2" alt="Bitwarden">
<img class="logo mb-2" alt="Bitwarden">
<div class="card d-block mt-4">
<div class="card-body" *ngIf="loggingIn">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
Expand Down
2 changes: 1 addition & 1 deletion src/app/accounts/verify-email-token.component.html
@@ -1,6 +1,6 @@
<div class="mt-5 d-flex justify-content-center">
<div>
<img src="../../images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<img class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span class="sr-only">{{'loading' | i18n}}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layouts/navbar.component.html
@@ -1,4 +1,4 @@
<nav class="navbar navbar-expand navbar-dark bg-primary" [ngClass]="{'bg-secondary-alt': selfHosted}">
<nav class="navbar navbar-expand navbar-dark" [ngClass]="{'bg-secondary-alt': selfHosted}">
<div class="container">
<a class="navbar-brand" routerLink="/" appA11yTitle="{{'pageTitle' | i18n : 'Bitwarden'}}">
<i class="fa fa-shield" aria-hidden="true"></i>
Expand Down
19 changes: 13 additions & 6 deletions src/app/services/services.module.ts
Expand Up @@ -91,12 +91,14 @@ import { UserService as UserServiceAbstraction } from 'jslib-common/abstractions
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from 'jslib-common/abstractions/vaultTimeout.service';
import { ModalService } from './modal.service';

import { ThemeType } from 'jslib-common/enums/themeType';

const i18nService = new I18nService(window.navigator.language, 'locales');
const stateService = new StateService();
const broadcasterService = new BroadcasterService();
const messagingService = new BroadcasterMessagingService(broadcasterService);
const consoleLogService = new ConsoleLogService(false);
const platformUtilsService = new WebPlatformUtilsService(i18nService, messagingService, consoleLogService);
const platformUtilsService = new WebPlatformUtilsService(i18nService, messagingService, consoleLogService, () => storageService);
const storageService: StorageServiceAbstraction = new HtmlStorageService(platformUtilsService);
const secureStorageService: StorageServiceAbstraction = new MemoryStorageService();
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,
Expand Down Expand Up @@ -161,11 +163,16 @@ export function initFactory(): Function {
authService.init();
const htmlEl = window.document.documentElement;
htmlEl.classList.add('locale_' + i18nService.translationLocale);
let theme = await storageService.get<string>(ConstantsService.themeKey);
if (theme == null) {
theme = 'light';
}
htmlEl.classList.add('theme_' + theme);

// Initial theme is set in index.html which must be updated if there are any changes to theming logic
platformUtilsService.onDefaultSystemThemeChange(async sysTheme => {
Hinton marked this conversation as resolved.
Show resolved Hide resolved
const bwTheme = await storageService.get<ThemeType>(ConstantsService.themeKey);
if (bwTheme === ThemeType.System) {
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
htmlEl.classList.add('theme_' + sysTheme);
}
});

stateService.save(ConstantsService.disableFaviconKey,
await storageService.get<boolean>(ConstantsService.disableFaviconKey));
stateService.save('enableGravatars', await storageService.get<boolean>('enableGravatars'));
Expand Down
13 changes: 12 additions & 1 deletion src/app/settings/options.component.html
Expand Up @@ -72,7 +72,7 @@ <h1>{{'options' | i18n}}</h1>
</div>
<small class="form-text text-muted">{{'enableGravatarsDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="enableFullWidth" name="enableFullWidth"
[(ngModel)]="enableFullWidth">
Expand All @@ -82,6 +82,17 @@ <h1>{{'options' | i18n}}</h1>
</div>
<small class="form-text text-muted">{{'enableFullWidthDesc' | i18n}}</small>
</div>
<div class="row">
eliykat marked this conversation as resolved.
Show resolved Hide resolved
<div class="col-6">
<div class="form-group">
<label for="theme">{{'theme' | i18n}}</label>
<select id="theme" name="theme" [(ngModel)]="theme" class="form-control">
<option *ngFor="let o of themeOptions" [ngValue]="o.value">{{o.name}}</option>
</select>
<small class="form-text text-muted">{{'themeDesc' | i18n}}</small>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">
{{'save' | i18n}}
</button>
Expand Down
18 changes: 18 additions & 0 deletions src/app/settings/options.component.ts
Expand Up @@ -15,6 +15,7 @@ import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.serv

import { ConstantsService } from 'jslib-common/services/constants.service';

import { ThemeType } from 'jslib-common/enums/themeType';
import { Utils } from 'jslib-common/misc/utils';

@Component({
Expand All @@ -26,13 +27,16 @@ export class OptionsComponent implements OnInit {
disableIcons: boolean;
enableGravatars: boolean;
enableFullWidth: boolean;
theme: string = null;
locale: string;
vaultTimeouts: { name: string; value: number; }[];
localeOptions: any[];
themeOptions: any[];

vaultTimeout: FormControl = new FormControl(null);

private startingLocale: string;
private startingTheme: string;
TheAutisticTechie marked this conversation as resolved.
Show resolved Hide resolved

constructor(private storageService: StorageService, private stateService: StateService,
private i18nService: I18nService, private toasterService: ToasterService,
Expand Down Expand Up @@ -62,6 +66,11 @@ export class OptionsComponent implements OnInit {
localeOptions.sort(Utils.getSortFunction(i18nService, 'name'));
localeOptions.splice(0, 0, { name: i18nService.t('default'), value: null });
this.localeOptions = localeOptions;
this.themeOptions = [
{ name: i18nService.t('themeLight'), value: null },
{ name: i18nService.t('themeDark'), value: ThemeType.Dark },
{ name: i18nService.t('themeSystem'), value: ThemeType.System },
];
}

async ngOnInit() {
Expand All @@ -71,6 +80,7 @@ export class OptionsComponent implements OnInit {
this.enableGravatars = await this.storageService.get<boolean>('enableGravatars');
this.enableFullWidth = await this.storageService.get<boolean>('enableFullWidth');
this.locale = this.startingLocale = await this.storageService.get<string>(ConstantsService.localeKey);
this.theme = this.startingTheme = await this.storageService.get<ThemeType>(ConstantsService.themeKey);
}

async submit() {
Expand All @@ -86,6 +96,14 @@ export class OptionsComponent implements OnInit {
await this.stateService.save('enableGravatars', this.enableGravatars);
await this.storageService.save('enableFullWidth', this.enableFullWidth);
this.messagingService.send('setFullWidth');
if (this.theme !== this.startingTheme) {
await this.storageService.save(ConstantsService.themeKey, this.theme);
this.startingTheme = this.theme;
const effectiveTheme = await this.platformUtilsService.getEffectiveTheme();
const htmlEl = window.document.documentElement;
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
htmlEl.classList.add('theme_' + effectiveTheme);
}
await this.storageService.save(ConstantsService.localeKey, this.locale);
if (this.locale !== this.startingLocale) {
window.location.reload();
Expand Down
78 changes: 53 additions & 25 deletions src/app/settings/payment.component.ts
Expand Up @@ -9,24 +9,14 @@ import { PaymentMethodType } from 'jslib-common/enums/paymentMethodType';
import { ApiService } from 'jslib-common/abstractions/api.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';

const StripeElementStyle = {
base: {
color: '#333333',
fontFamily: '"Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, ' +
'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
fontSize: '14px',
fontSmoothing: 'antialiased',
},
invalid: {
color: '#333333',
},
};

const StripeElementClasses = {
focus: 'is-focused',
empty: 'is-empty',
invalid: 'is-invalid',
};
import { ThemeType } from 'jslib-common/enums/themeType';

import ThemeVariables from 'src/scss/export.module.scss';

const lightInputColor = ThemeVariables.lightInputColor;
const lightInputPlaceholderColor = ThemeVariables.lightInputPlaceholderColor;
const darkInputColor = ThemeVariables.darkInputColor;
const darkInputPlaceholderColor = ThemeVariables.darkInputPlaceholderColor;

@Component({
selector: 'app-payment',
Expand Down Expand Up @@ -59,6 +49,8 @@ export class PaymentComponent implements OnInit {
private stripeCardNumberElement: any = null;
private stripeCardExpiryElement: any = null;
private stripeCardCvcElement: any = null;
private StripeElementStyle: any;
private StripeElementClasses: any;

constructor(private platformUtilsService: PlatformUtilsService, private apiService: ApiService) {
this.stripeScript = window.document.createElement('script');
Expand All @@ -72,14 +64,36 @@ export class PaymentComponent implements OnInit {
this.btScript = window.document.createElement('script');
this.btScript.src = `scripts/dropin.js?cache=${process.env.CACHE_TAG}`;
this.btScript.async = true;
this.StripeElementStyle = {
eliykat marked this conversation as resolved.
Show resolved Hide resolved
base: {
color: null,
fontFamily: '"Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, ' +
'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
fontSize: '14px',
fontSmoothing: 'antialiased',
'::placeholder': {
color: null,
},
},
invalid: {
color: null,

},
};
this.StripeElementClasses = {
focus: 'is-focused',
empty: 'is-empty',
invalid: 'is-invalid',
};
}

ngOnInit() {
async ngOnInit() {
if (!this.showOptions) {
this.hidePaypal = this.method !== PaymentMethodType.PayPal;
this.hideBank = this.method !== PaymentMethodType.BankAccount;
this.hideCredit = this.method !== PaymentMethodType.Credit;
}
await this.setTheme();
window.document.head.appendChild(this.stripeScript);
if (!this.hidePaypal) {
window.document.head.appendChild(this.btScript);
Expand Down Expand Up @@ -133,6 +147,7 @@ export class PaymentComponent implements OnInit {
size: 'medium',
shape: 'pill',
color: 'blue',
tagline: 'false',
},
},
}, (createErr: any, instance: any) => {
Expand Down Expand Up @@ -216,21 +231,21 @@ export class PaymentComponent implements OnInit {
if (this.showMethods && this.method === PaymentMethodType.Card) {
if (this.stripeCardNumberElement == null) {
this.stripeCardNumberElement = this.stripeElements.create('cardNumber', {
style: StripeElementStyle,
classes: StripeElementClasses,
style: this.StripeElementStyle,
classes: this.StripeElementClasses,
placeholder: '',
});
}
if (this.stripeCardExpiryElement == null) {
this.stripeCardExpiryElement = this.stripeElements.create('cardExpiry', {
style: StripeElementStyle,
classes: StripeElementClasses,
style: this.StripeElementStyle,
classes: this.StripeElementClasses,
});
}
if (this.stripeCardCvcElement == null) {
this.stripeCardCvcElement = this.stripeElements.create('cardCvc', {
style: StripeElementStyle,
classes: StripeElementClasses,
style: this.StripeElementStyle,
classes: this.StripeElementClasses,
placeholder: '',
});
}
Expand All @@ -240,4 +255,17 @@ export class PaymentComponent implements OnInit {
}
}, 50);
}

private async setTheme() {
const theme = await this.platformUtilsService.getEffectiveTheme();
if (theme === ThemeType.Dark) {
this.StripeElementStyle.base.color = darkInputColor;
this.StripeElementStyle.base['::placeholder'].color = darkInputPlaceholderColor;
this.StripeElementStyle.invalid.color = darkInputColor;
} else {
this.StripeElementStyle.base.color = lightInputColor;
this.StripeElementStyle.base['::placeholder'].color = lightInputPlaceholderColor;
this.StripeElementStyle.invalid.color = lightInputColor;
}
}
}
2 changes: 1 addition & 1 deletion src/app/vault/add-edit.component.html
Expand Up @@ -103,7 +103,7 @@ <h2 class="modal-title" id="cipherAddEditTitle">{{title}}</h2>
</div>
<div class="col-6 form-group totp d-flex align-items-end" [ngClass]="{'low': totpLow}">
<div *ngIf="!cipher.login.totp || !totpCode">
<img src="../../images/totp-countdown.png" title="{{'verificationCodeTotp' | i18n}}"
<img src="../../images/totp-countdown.png" id="totpImage" title="{{'verificationCodeTotp' | i18n}}"
class="ml-2">
<a href="#" appStopClick class="badge badge-primary ml-3" (click)="premiumRequired()"
*ngIf="!organization && !cipher.organizationId && !canAccessPremium">
Expand Down
6 changes: 6 additions & 0 deletions src/images/loading-white.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/logo-white@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/images/totp-countdown.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion src/index.html
Expand Up @@ -8,6 +8,23 @@

<title page-title>Bitwarden Web Vault</title>

<script>
(function () {
// Set theme on page load
// This is done outside the Angular app to avoid a flash of unthemed content before it loads
let theme = window.localStorage.getItem('theme');
if (theme?.indexOf('system') > -1) {
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
} else if (theme?.indexOf('dark') > -1) {
theme = 'dark';
}
else {
theme = 'light';
}
document.documentElement.classList.add('theme_' + theme);
})();
</script>

<link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png">
Expand All @@ -19,7 +36,7 @@
<app-root>
<div class="mt-5 d-flex justify-content-center">
<div>
<img src="./images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<img class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i>
</p>
Expand Down
15 changes: 15 additions & 0 deletions src/locales/en/messages.json
Expand Up @@ -4094,6 +4094,21 @@
"removeUsersWarning": {
"message": "Are you sure you want to remove the following users? The process may take a few seconds to complete and cannot be interrupted or canceled."
},
"theme": {
"message": "Theme"
},
"themeDesc": {
"message": "Choose a theme for your web vault."
},
"themeSystem": {
"message": "Use System Theme"
},
"themeDark": {
"message": "Dark"
},
"themeLight": {
"message": "Light"
},
"confirmSelected": {
"message": "Confirm Selected"
},
Expand Down