Post

Replies

Boosts

Views

Activity

Safari toolbar icon colour ?
I checked the official documentation but I could not see a specific colour to use for the icons sitting in Safari's toolbar (e.g. "toolbar-icon-72"). I have tried a number of different greys and although I have the one that looks good to my eye, it may be a little off to others. So I was wondering if there was a recommended colour ? I also tried using the bundled Digital Colour Meter in macOS to determine a single grey colour, but of course, at the pixel level, anti-aliasing leaves that very much down to interpretation. I have gone with 141/141/141 (RGB).
Topic: Safari & Web SubTopic: General Tags:
0
1
445
Nov ’23
Safari Extension : download image on click event (document.addEventListener)
I am trying to design a Safari extension to register a mouse-click on a webpage's image to automatically download that image when clicked on (whilst holding down the Command key). function handleImageClick(event) { if (event.target.tagName === 'IMG') { const imageUrl = event.target.src; const link = document.createElement('a'); link.href = imageUrl; link.download = 'image'; link.click(); } } document.addEventListener('click', handleImageClick); However, I am having no luck and wonder if it's because all functionality is limited to the toolbar popover ?
0
0
347
Nov ’23
QR Code Generator (CIFilter) colours for light/dark mode ?
Using the CIFilter.qrCodeGenerator() to create a QR code I wanted to change the colours dynamically to suit Light/Dark mode, but was unable to figure out how to achieve this, is it possible please ? struct QrCodeImage {     let context = CIContext()     func generateQRCode(from text: String) -> UIImage {         var qrImage = UIImage(systemName: "xmark.circle") ?? UIImage()         let data = Data(text.utf8)         let filter = CIFilter.qrCodeGenerator()         filter.setValue(data, forKey: "inputMessage")         let transform = CGAffineTransform(scaleX: 2, y: 2)         if let outputImage = filter.outputImage?.transformed(by: transform) {             if let image = context.createCGImage(                 outputImage,                 from: outputImage.extent) {                 qrImage = UIImage(cgImage: image)             }         }         return qrImage     } } Further, I cannot see an option for the different modes and assume that any colour could be used, which would be a lot better for me. ref: https://developer.apple.com/documentation/coreimage/ciqrcodegenerator
2
0
2.4k
Mar ’22
Safari toolbar icon colour ?
I checked the official documentation but I could not see a specific colour to use for the icons sitting in Safari's toolbar (e.g. "toolbar-icon-72"). I have tried a number of different greys and although I have the one that looks good to my eye, it may be a little off to others. So I was wondering if there was a recommended colour ? I also tried using the bundled Digital Colour Meter in macOS to determine a single grey colour, but of course, at the pixel level, anti-aliasing leaves that very much down to interpretation. I have gone with 141/141/141 (RGB).
Topic: Safari & Web SubTopic: General Tags:
Replies
0
Boosts
1
Views
445
Activity
Nov ’23
Safari Extension : download image on click event (document.addEventListener)
I am trying to design a Safari extension to register a mouse-click on a webpage's image to automatically download that image when clicked on (whilst holding down the Command key). function handleImageClick(event) { if (event.target.tagName === 'IMG') { const imageUrl = event.target.src; const link = document.createElement('a'); link.href = imageUrl; link.download = 'image'; link.click(); } } document.addEventListener('click', handleImageClick); However, I am having no luck and wonder if it's because all functionality is limited to the toolbar popover ?
Replies
0
Boosts
0
Views
347
Activity
Nov ’23
QR Code Generator (CIFilter) colours for light/dark mode ?
Using the CIFilter.qrCodeGenerator() to create a QR code I wanted to change the colours dynamically to suit Light/Dark mode, but was unable to figure out how to achieve this, is it possible please ? struct QrCodeImage {     let context = CIContext()     func generateQRCode(from text: String) -> UIImage {         var qrImage = UIImage(systemName: "xmark.circle") ?? UIImage()         let data = Data(text.utf8)         let filter = CIFilter.qrCodeGenerator()         filter.setValue(data, forKey: "inputMessage")         let transform = CGAffineTransform(scaleX: 2, y: 2)         if let outputImage = filter.outputImage?.transformed(by: transform) {             if let image = context.createCGImage(                 outputImage,                 from: outputImage.extent) {                 qrImage = UIImage(cgImage: image)             }         }         return qrImage     } } Further, I cannot see an option for the different modes and assume that any colour could be used, which would be a lot better for me. ref: https://developer.apple.com/documentation/coreimage/ciqrcodegenerator
Replies
2
Boosts
0
Views
2.4k
Activity
Mar ’22