Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notes-app
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abhay Menon
notes-app
Commits
e7f1b110
Commit
e7f1b110
authored
2 years ago
by
Guransh Khurana
Browse files
Options
Downloads
Patches
Plain Diff
created a toggleDarkMode function and implemented action for menu bar items dark and light
parent
de1a2954
No related branches found
No related tags found
3 merge requests
!34
All additional functionalities added
,
!33
Added theme and image support functionality to the note app
,
!32
Draft: Dark theme main serverless
Pipeline
#90028
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt
+15
-0
15 additions, 0 deletions
...s/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt
utilities/src/main/kotlin/notes/multi/utilities/Themes.kt
+26
-0
26 additions, 0 deletions
utilities/src/main/kotlin/notes/multi/utilities/Themes.kt
with
41 additions
and
0 deletions
utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt
+
15
−
0
View file @
e7f1b110
...
...
@@ -44,6 +44,7 @@ class TextWindow(): Application() {
private
var
newname
=
true
private
var
curfile
=
Note
()
var
isDarkMode
=
false
private
fun
notesname
()
:
MutableList
<
String
>
{
val
retlist
=
mutableListOf
<
String
>()
...
...
@@ -256,6 +257,8 @@ class TextWindow(): Application() {
}
}
filemenu
.
items
.
addAll
(
open
,
save
,
delete
)
modechange
.
items
.
addAll
(
dark
,
light
)
menubar
.
menus
.
addAll
(
filemenu
,
modechange
)
...
...
@@ -265,6 +268,18 @@ class TextWindow(): Application() {
stage
.
scene
=
Scene
(
box
,
300.0
,
300.0
)
dark
.
setOnAction
{
if
(!
isDarkMode
)
{
toggleDarkMode
(
stage
.
scene
,
isDarkMode
)
}
}
light
.
setOnAction
{
if
(
isDarkMode
)
{
toggleDarkMode
(
stage
.
scene
,
isDarkMode
)
}
}
/**
* Logic for key presses:
* - Save: Ctrl + S
...
...
This diff is collapsed.
Click to expand it.
utilities/src/main/kotlin/notes/multi/utilities/Themes.kt
0 → 100644
+
26
−
0
View file @
e7f1b110
package
notes.multi.utilities
import
javafx.application.Application
import
javafx.scene.Scene
import
javafx.stage.Stage
import
javafx.geometry.Pos
import
javafx.scene.control.Button
import
javafx.scene.control.Label
import
javafx.scene.layout.StackPane
import
javafx.scene.layout.VBox
import
javafx.scene.paint.Color
import
javafx.scene.text.Font
import
javax.swing.text.html.StyleSheet
fun
toggleDarkMode
(
scene
:
Scene
,
isDarkMode
:
Boolean
)
{
//val darktheme: StyleSheet = StyleSheet(false, "notes/multi/utilities/darktheme.css")
if
(
isDarkMode
)
{
//note.text.toString(). = Color.WHITE
scene
.
root
.
style
=
"-fx-background-color: ${Color.BLACK.toString().replace("
0
x
", "
#
")}; -fx-text-fill: ${Color.WHITE.toString().replace("
0
x
", "
#
")}"
}
else
{
//note.text = Color.BLACK
scene
.
root
.
style
=
"-fx-background-color: ${Color.WHITE.toString().replace("
0
x
", "
#
")}; -fx-text-fill: ${Color.BLACK.toString().replace("
0
x
", "
#
")}"
}
//isDarkMode = !isDarkMode
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment