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

White Label Customisation Configuration #84

Merged
merged 9 commits into from
Jan 30, 2024

Conversation

HunnySajid
Copy link
Collaborator

@HunnySajid HunnySajid commented Jan 26, 2024

#17

@rodolfomiranda I think we can not change the extension icon and can not load the logo in the content script. We will update the JSON structure once we get the requirements.

@HunnySajid
Copy link
Collaborator Author

HunnySajid commented Jan 26, 2024

@2byrds @rodolfomiranda poc for vendor customization

Screen.Recording.2024-01-26.at.9.47.53.PM.mov

@2byrds
Copy link
Collaborator

2byrds commented Jan 26, 2024

@2byrds @rodolfomiranda poc for vendor customization

Screen.Recording.2024-01-26.at.9.47.53.PM.mov

Super cool!

@rodolfomiranda
Copy link
Collaborator

@HunnySajid , I was able to change the action icon dynamically from the background script with the following code:

const imageBlob = await fetch('https://upload.wikimedia.org/wikipedia/commons/1/1d/Smile_icon_32x32.png').then(r => r.blob())
const bitmap = await createImageBitmap(imageBlob)
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
const context = canvas.getContext('2d');
context?.drawImage(bitmap ,0,0);
const imageData = context?.getImageData(0, 0, bitmap.width, bitmap.height);
chrome.action.setIcon({ imageData: imageData} );

The same technique should work from the content script

@HunnySajid
Copy link
Collaborator Author

HunnySajid commented Jan 30, 2024

@HunnySajid , I was able to change the action icon dynamically from the background script with the following code:

const imageBlob = await fetch('https://upload.wikimedia.org/wikipedia/commons/1/1d/Smile_icon_32x32.png').then(r => r.blob())
const bitmap = await createImageBitmap(imageBlob)
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
const context = canvas.getContext('2d');
context?.drawImage(bitmap ,0,0);
const imageData = context?.getImageData(0, 0, bitmap.width, bitmap.height);
chrome.action.setIcon({ imageData: imageData} );

The same technique should work from the content script

@rodolfomiranda Thanks for sharing the snippet. I have made above changes and now actionIcon and content scripts are loading logo image from JSON. Please review and merge

@rodolfomiranda rodolfomiranda merged commit 1af093f into WebOfTrust:main Jan 30, 2024
@HunnySajid HunnySajid deleted the feat/poc-customization branch January 30, 2024 15:39
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.

3 participants