Antwort auf: Bleibender Dark Mode

Startseite Foren Deutsches LiveCode-Forum Bleibender Dark Mode Antwort auf: Bleibender Dark Mode

#19902
BestRazer
Teilnehmer

    Stack:

    global darkmode
    
    on openstack
       ## Zuerst die Datei einlesen
       put specialfolderpath("documents") & "/dark_mode" into tFile
       
       ## Noch keine Datei vorhanden -> auf DEFAULT setzen:
       if there is not a file tFile then
          put "false" into derModus
       else
          put url ("file:" & tFile) into derModus
       end if
       
       ## Weiterer Trick, da LC zuerst alles in Klammern auflöst:
       set the highlight of widget "dark" to (darkmode = "dark")
       ## Bitte mal auf der zunge zergehen lassen.
       ## Diese Logik ist essentiell fürs Programmieren!
       
       ## Siehe oben, Mr. Boole und seine Logik ist unser Freund!
       ##if darkmode = "dark" then
       ##   set the highlight of widget "dark" to "true"
       ##else
       ##   set the highlight of widget "dark" to "false"
       ##end if
    end openstack

    Schalter:

    on hiliteChanged
       if the highlight of me then
          
          
          set the backgroundColor of card "VP App" to "#000000"
          set the backgroundColor of field "Field" to "#000000"
          set the foregroundColor of field "Field" to "#ffffff"
          set the backgroundColor of field "infos" to "#000000"
          set the foregroundColor of field "infos" to "#ffffff"
          
       else
          
          
          set the backgroundColor of card "VP App" to "#ffffff"
          set the backgroundColor of field "Field" to "#ffffff"
          set the foregroundColor of field "Field" to "#000000"
          set the backgroundColor of field "infos" to "#ffffff"
          set the foregroundColor of field "infos" to "#000000"
          
       end if   
       
    
       
       ## Einmal reicht, Tipparbeit sparen!:
       put specialfolderpath("documents") & "/dark_mode" into tDatei
       if the highlight of me then
          put "dark" into darkmode     
       else
          put "light" into darkmode
       end if
       ## Jetzt erst wegschreiben:
       put darkmode into url("file:" & tDatei)
       
       
    end hiliteChanged