Skip to content
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

feat: allow background images #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jh123x
Copy link
Contributor

@Jh123x Jh123x commented Jun 20, 2024

No description provided.

"permissions": [
"storage"
]
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this file? it should already exist in the public dir?

@@ -1,3 +1,4 @@
/// <reference types="chrome"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats this for?

<Particles />
<img src={settings.themeBackgroundImagePath} />
<img src={settings.themeBackgroundImageBase64 ? `data:image/jpeg;base64,` + settings.themeBackgroundImageBase64 : ""} />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you set it so that the image rendered correctly:

  1. If no image is configured, then dont need this img at all
  2. Add settings to adjust the background: alignment (left bottom / right top / center / etc), size (cover / contains / fit / etc)
  3. Feel free to change into css background if its better, I just put random here just for future reminder.

b64Image = btoa(new Uint8Array(result).reduce((data, byte) => data + String.fromCharCode(byte), ''));
setSettingValue('themeBackgroundImageBase64', b64Image);
};
fileData.readAsArrayBuffer(fileName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to create separate function so that this can be just `loadImageAsBase64(filePath).then((base64Image) => setSettingValue('themeBackgroundImageBase64', base64Image))

@@ -5,7 +5,7 @@ import db from '../dal/storage';
export const defaultSettings: Settings = {
themeForegroundColor: 'white',
themeBackgroundColor: 'black',
themeBackgroundImagePath: undefined,
themeBackgroundImageBase64: undefined,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For discussion: do you think better to store the base64 somewhere else?
For example, use db.load('backgroundImage').
Then, when we open the devtools, the settings will still be easy to read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants