Giter Site home page Giter Site logo

Comments (9)

sassanh avatar sassanh commented on June 30, 2024

Never mind, I needed so much modifications that I ended up opening the project in XCode and doing lots of modifications to get my desired icons. I had to comment lots of lines so that it doesn't change other icons (mostly if (!image) lines), I had to convert NSImage to CIImage and adjust brightness because icons in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ are too sharp. and then convert it back to NSImage + some other minor modifications. Eventually I got my desired download icon (exactly looks like the native one 😄 ) thank you so much for this plugin, it couldn't be done without mySIMBL and colorfulSidebar.

from colorfulsidebar.

whoaitsaimz avatar whoaitsaimz commented on June 30, 2024

Can you submit your modified config? I'd like to change some icons but not the defaults, too.

from colorfulsidebar.

sassanh avatar sassanh commented on June 30, 2024

@whoaitsaimz take a look at my fork and this commit: sassanh@8c01e78

from colorfulsidebar.

krackers avatar krackers commented on June 30, 2024

Note that on 10.9 I ran into this issue due to the use of TiffRepresentation. This is fixed by creating the CIImage from a CGImage directly instead of converting to the tiff intermediary:

    NSImage * image = [[NSImage alloc] initWithContentsOfFile:key];
    
    NSRect imageRect = NSMakeRect(0, 0, image.size.width, image.size.height);
    CGImageRef cgImage = [image CGImageForProposedRect:&imageRect context:NULL hints:nil];
    CIImage *ciImage = [[CIImage alloc] initWithCGImage:cgImage];

from colorfulsidebar.

krackers avatar krackers commented on June 30, 2024

Also it seems native icons (in 10.9 at least) have a gradient applied to them. @sassanh How did you arrive at the filter you used? Was it just trial and error or did you reverse engineer the one used by the finder?

from colorfulsidebar.

sassanh avatar sassanh commented on June 30, 2024

Well I'm on Sierra. Can't remember how I found that filter. I guess it should've been trial and error but I somehow feel I got certain that this is what Finder does itself.

from colorfulsidebar.

krackers avatar krackers commented on June 30, 2024

Interesting. I took a look into how dropbox does its code injection for the sidebar icon on mavericks (which looks and feels exactly like native) and it turns out that if you do [image setTemplate:true]; after the addRepresentation then the OS automatically applies the appropriate shading and highlight.

After I did this the black->white invert when the sidebar item is selected worked (exactly like it does on native icons). I recommend you add this to your fork so it is even closer to native behavior.

The only odd/interesting thing is that even with [image setTemplate:true]; you still need to apply the lightening CIFilter, albeit not as much as before. With [image setTemplate:true]; I found via experimentation that [ciFilter setValue:[NSNumber numberWithFloat:.04] forKey:@"inputBrightness"]; closely matched native icons (on mavericks at least). I'm not sure why lightening is necessary even with the system template applied, but it might be due to a difference in how the image is loaded (the dropbox bundle did some weird thing creating a CGImage from a PNG CGDataProvider that allowed for playing around with some color space/upscaling options).

For further investigation might be the NSSidebarImage class in appkit that Finder (and many other cocoa apps leverage).

from colorfulsidebar.

sassanh avatar sassanh commented on June 30, 2024

Can you prepare a pull request for setTemplate: treu?

from colorfulsidebar.

krackers avatar krackers commented on June 30, 2024

Alright done. See sassanh#1

from colorfulsidebar.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.