-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library: Adds ColorPicker Demo #335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not using the promisified version using await
Please refer to the Screenshot
library entry.
1959adb
to
16db4a0
Compare
using Adw 1; | ||
|
||
Adw.StatusPage { | ||
title: "Color Picker"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: "Color Picker"; | |
title: _("Color Picker"); |
label: _("Select Color"); | ||
margin-bottom: 42; | ||
halign: center; | ||
styles ["suggested-action"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
styles ["suggested-action"] | |
styles ["suggested-action", "pill"] |
} | ||
} | ||
|
||
button.connect("clicked", pickColor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to #330 (comment)
Remove the try/catch, rename and do
button.connect("clicked", pickColor); | |
button.connect("clicked", () => { | |
onClicked().catch(logError); | |
}); |
|
||
async function pickColor() { | ||
try { | ||
const color = await portal.pick_color(parent, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the result of pick_color
isn't really a color, I would naming the return value result
instead and move the comment there
const color = await portal.pick_color(parent, null); | |
// result is a GVariant of the form (ddd), containing red, green and blue components in the range [0,1] | |
const result = await portal.pick_color(parent, null); |
const colorInfo = color.print(false); | ||
|
||
// The picked color is a GVariant of the form (ddd), containing red, green and blue components in the range [0,1]. | ||
console.log(`Selected Color is: ${colorInfo}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt we create a rgba color with https://docs.gtk.org/gdk4/struct.RGBA.html and then use color.to_string()
?
similar to the Color Dialog entry
You can read rgb from result
using const [r,g,b] = result.deepUnpack()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Made the following changes:
|
* libary: Add SpinButton entry * Spin Button: Add link to tutorial * Spin Button: Changes from review * Spin Button: Translated strings * Spin Button: Add comments for clarity
* library: Add AdwBanner entry * Banner: Translate strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done ✨
Screencast.from.2023-06-14.11-47-15.webm
Closes #334