{"id":13584117,"url":"https://github.com/anthonygelibert/QLColorCode","last_synced_at":"2025-04-06T22:32:04.664Z","repository":{"id":3813578,"uuid":"4893501","full_name":"anthonygelibert/QLColorCode","owner":"anthonygelibert","description":"QuickLook plugin for source code with syntax highlighting.","archived":false,"fork":true,"pushed_at":"2024-12-07T22:29:07.000Z","size":425,"stargazers_count":675,"open_issues_count":21,"forks_count":49,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-12-07T23:22:41.913Z","etag":null,"topics":["code-source","highlight","macos","quicklook-plugin"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"derzzle/QLColorCode","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anthonygelibert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-04T22:15:29.000Z","updated_at":"2024-12-07T22:58:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/anthonygelibert/QLColorCode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygelibert%2FQLColorCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygelibert%2FQLColorCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygelibert%2FQLColorCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygelibert%2FQLColorCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonygelibert","download_url":"https://codeload.github.com/anthonygelibert/QLColorCode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247563900,"owners_count":20958971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-source","highlight","macos","quicklook-plugin"],"created_at":"2024-08-01T15:04:01.433Z","updated_at":"2025-04-06T22:32:04.658Z","avatar_url":"https://github.com/anthonygelibert.png","language":"Objective-C","readme":"# QLColorCode\n\n[![Build Status](https://travis-ci.org/anthonygelibert/QLColorCode.svg?branch=master)](https://travis-ci.org/anthonygelibert/QLColorCode)\n\n**Original project:** \u003chttp://code.google.com/p/qlcolorcode/\u003e\n\nThis is a Quick Look plug-in that renders source code with syntax highlighting, using the\n[Highlight library](http://www.andre-simon.de).\n\nTo install the plug-in, just drag it to `~/Library/QuickLook`. You may need to create that folder if it doesn't already\nexist.\n\nAlternatively, if you use [Homebrew Cask](https://github.com/caskroom/homebrew-cask), install with\n`brew install --cask qlcolorcode`. Also available on [MacPorts](https://www.macports.org): `port install QLColorCode`.\n\n**To build the project, you must have Boost headers on your system in `/opt/local/include` or `/usr/local/include`.**\n\n## Settings\n\nIf you want to configure `QLColorCode`, there are several `defaults` commands that could be useful:\n\nSetting the text encoding (default is `UTF-8`). Two settings are required. The first sets Highlight's encoding, the\nsecond sets Webkit's:\n\n    defaults write org.n8gray.QLColorCode textEncoding UTF-16\n    defaults write org.n8gray.QLColorCode webkitTextEncoding UTF-16\n\nSetting the font (default is `Menlo`):\n\n    defaults write org.n8gray.QLColorCode font Monaco\n\nSetting the font size (default is `10`):\n\n    defaults write org.n8gray.QLColorCode fontSizePoints 9\n\nSetting the color style for `light` and `dark` mode (see\n[all available themes](http://www.andre-simon.de/doku/highlight/theme-samples.php)):\n\n    defaults write org.n8gray.QLColorCode lightTheme solarized-light\n    defaults write org.n8gray.QLColorCode darkTheme solarized-dark\n\nSetting the thumbnail color style (deactivated by default):\n\n    defaults write org.n8gray.QLColorCode hlThumbTheme ide-xcode\n\nSetting the maximum size (in bytes, deactivated by default) for previewed files:\n\n    defaults write org.n8gray.QLColorCode maxFileSize 1000000\n\nzSetting any extra command-line flags for Highlight (see below):\n\n    defaults write org.n8gray.QLColorCode extraHLFlags '-l -W'\n\nHere are some useful 'highlight' command-line flags (from the main page):\n\n       -F, --reformat=\u003cstyle\u003e\n              reformat output in given style.   \u003cstyle\u003e=[ansi,  gnu,  kr,\n              java, linux]\n\n       -J, --line-length=\u003cnum\u003e\n              line length before wrapping (see -W, -V)\n\n       -j, --line-number-length=\u003cnum\u003e\n              line number length incl. left padding\n\n       -l, --line-numbers\n              print line numbers in output file\n\n       -t  --replace-tabs=\u003cnum\u003e\n              replace tabs by num spaces\n\n       -V, --wrap-simple\n              wrap long lines without indenting function  parameters  and\n              statements\n\n       -W, --wrap\n              wrap long lines\n\n       -z, --zeroes\n              fill leading space of line numbers with zeroes\n\n       --kw-case=\u003cupper|lower|capitalize\u003e\n              control case of case insensitive keywords\n\nIt is also possible to have the HTML preview converted to RTF. Using RTF allows the contents of the file to be displayed\ninstead of an icon -- similar to QLStephen.\n\n    defaults write org.n8gray.QLColorCode rtfRender true\n\n## Additional information\n\n### Additional features\n\n#### Decompile\n\nQLColorCode decompiles some formats:\n\n- **Compiled AppleScript**. It requires `osadecompile` installed at `/usr/bin/osadecompile`.\n- **Binary PLIST**. It requires `plutil` installed at `/usr/bin/plutil`.\n\n### Highlight\n\n#### Plug-ins\n\nQLColorCode enables some Highlight plug-ins :\n\n- In all languages: `outhtml_codefold` and `reduce_filesize`.\n- Java (sources and classes): `java_library`.\n- C/C++: `cpp_syslog`, `cpp_ref_cplusplus_com` and `cpp_ref_local_includes`.\n- Perl: `perl_ref_perl_org`.\n- Python: `python_ref_python_org`.\n- Shell: `bash_functions`.\n- Scala: `scala_ref_scala_lang_org`.\n\n#### Handled languages\n\nHighlight can handle lots and lots of languages, but this plug-in will only be invoked for file types that the OS knows\nare type \"source-code\". Since the OS only knows about a limited number of languages, I've added Universal Type\nIdentifier (UTI) declarations for several \"interesting\" languages. If I've missed your favorite language, take a look at\nthe Info.plist file inside the plug-in bundle and look for the UTImportedTypeDeclarations section. I haven't added all\nthe languages that Highlight can handle because it's rumored that having two conflicting UTI declarations for the same\nfile extension can cause problems. Note that if you do edit the Info.plist file you need to nudge the system to tell it\nsomething has changed. Moving the plug-in to the desktop then back to its installed location should do the trick.\n\nAs an aside, by changing colorize.sh you can use this plug-in to render any file type that you can convert to HTML. Have\nfun, and let me know if you do anything cool!\n\n##### Adding Language Types\n\nIf QLColorCode doesn't display PHP and JavaScript code properly, their types may need to be added to Info.plist. Finding\nthe right type string to use is the tricky part. Getting the type strings and getting Info.plist edits to take effect is\neasy by following the steps below, which explain how to add support for PHP:\n\n1. In Terminal.app (or any shell prompt), enter the command:\n\n```bash\nmdls -name kMDItemContentType /full/path/to/file.php\n```\n\nUse the path to any PHP file. The response will be:\n\n```txt\nkMDItemContentType = \"public.php-script\"\n```\n\nThe string `public.php-script` is the type string needed in a later step.\n\n2. Again at a shell prompt, enter the command:\n\n```bash\nopen ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist\n```\n\nThis will open Info.plist in Xcode.app.\n\n3. In Xcode.app's edit window for Info.plist, go to:\n\n`Document types \u003e Item 0 \u003e Document Content Type UTIs`\n\n(If the editor is showing raw keys, that's: CFBundleDocumentTypes \u003e Item 0 \u003e LSItemContentTypes)\n\n4. Add an item for `public.php-script`, the type string found in the first step.\n5. Save the updated Info.plist file.\n6. Try it in Finder. (It's usually unnecessary to move/return the QLColorCode extension, restart QuickLook, or restart\n   the Finder, but it wouldn't be surprising that some users might need to do so.)\n","funding_links":[],"categories":["Objective-C","Plugins"],"sub_categories":["Using [HomeBrew Cask](http://caskroom.github.io/)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonygelibert%2FQLColorCode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonygelibert%2FQLColorCode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonygelibert%2FQLColorCode/lists"}