@@ -91,7 +91,6 @@ var FlasherFactory = (function () {
9191 var notification = envelope . notification ;
9292 var nOptions = notification . options || { } ;
9393 var options = Array . isArray ( nOptions ) ? this . options : Object . assign ( { } , this . options , nOptions ) ;
94- this . applyDarkMode ( ) ;
9594 var onContainerReady = function ( ) {
9695 var container = _this . createContainer ( options ) ;
9796 _this . addToContainer ( container , envelope , options ) ;
@@ -104,6 +103,7 @@ var FlasherFactory = (function () {
104103 } ;
105104 FlasherFactory . prototype . renderOptions = function ( options ) {
106105 this . options = Object . assign ( { } , this . options , options ) ;
106+ this . applyDarkMode ( ) ;
107107 } ;
108108 FlasherFactory . prototype . createContainer = function ( options ) {
109109 var containerSelector = ".fl-main-container[data-position=\"" . concat ( options . position , "\"]" ) ;
@@ -183,6 +183,9 @@ var FlasherFactory = (function () {
183183 template . addEventListener ( 'mouseover' , function ( ) { return clearInterval ( progressInterval ) ; } ) ;
184184 } ;
185185 FlasherFactory . prototype . applyDarkMode = function ( ) {
186+ if ( document . body . classList . contains ( 'fl-dark-mode' ) ) {
187+ return ;
188+ }
186189 var _a = [ ] . concat ( this . options . darkMode ) , mode = _a [ 0 ] , _b = _a [ 1 ] , className = _b === void 0 ? '.dark' : _b ;
187190 var css = '.fl-main-container .fl-container.fl-flasher {background-color: rgb(15, 23, 42);color: rgb(255, 255, 255);}' ;
188191 css = 'media' === mode
@@ -192,6 +195,7 @@ var FlasherFactory = (function () {
192195 style . type = 'text/css' ;
193196 style . appendChild ( document . createTextNode ( css ) ) ;
194197 document . head . appendChild ( style ) ;
198+ document . body . classList . add ( 'fl-dark-mode' ) ;
195199 } ;
196200 FlasherFactory . prototype . stringToHTML = function ( str ) {
197201 var support = ( function ( ) {
0 commit comments