diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2a9c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,162 @@ +## Python gitignore +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +## Jetbrains +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# Editor-based Rest Client +.idea/httpRequests + +# SonarLint +.idea/sonarlint + +# CMake +cmake-build-*/ + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b7997b5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: python +python: + - "3.5" + - "3.6" + - "3.7" + - "3.8" + - "pypy3" +install: + - pip install . +script: + - colout --help + - echo heyoo | colout hey yellow diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1aba38f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE diff --git a/README.md b/README.md new file mode 100644 index 0000000..10bde37 --- /dev/null +++ b/README.md @@ -0,0 +1,397 @@ +colout — Color Up Arbitrary Command Output +========================================== + +

+Colout logo +

+ +## Synopsis + +`colout [-h] [-r [RESOURCE]]` + +`colout [-g] [-c] [-l min,max] [-a] [-t] [-T DIR] [-P DIR] [-d COLORMAP] [-s] [-e CHAR] [-E CHAR] [--debug] PATTERN [COLOR(S) [STYLE(S)]]` + +## Description + +`colout` read lines of text stream on the standard input and output characters +matching a given regular expression *PATTERN* in given *COLOR* and *STYLE*. + +If groups are specified in the regular expression pattern, only them are taken +into account, else the whole matching pattern is colored. + +You can specify several colors or styles when using groups by separating them +with commas. If you indicate more colors than groups, the last ones will be ignored. +If you ask for fewer colors, the last one will be duplicated across remaining +groups. + +Available colors are: blue, black, yellow, cyan, green, magenta, white, red, +rainbow, random, Random, Spectrum, spectrum, scale, Scale, hash, Hash, none, an +RGB hexadecimal triplet (`#11aaff`, for example) or any number between 0 and 255. + +Available styles are: normal, bold, faint, italic, underline, blink, +rapid_blink, reverse, conceal or random (some styles may have no effect, depending +on your terminal). + +In some case, you can indicate a foreground and a background color, by indicating both colors +separated by a period (for example: `red.blue`). You can also use this system to combine two styles +(for example, for a bold style that also blinks: `bold.blink`). + +`rainbow` will cycle over a the default colormap at each matching pattern. +`Rainbow` will do the same over the default colormap for the 256-colors mode +(this requires a terminal that supports the 256 color escape sequences). + +`Random` will color each matching pattern with a random color among the default colormap +(the 255 available in the ANSI table, by default). +`random` will do the same in 8 colors mode. + +`spectrum` and `Spectrum` are like rainbows, but with more colors (8 and 36 +colors). + +`scale` (8 colors) and `Scale` (256 colors) will parse the numbers characters in +the matching text as a decimal number and apply the default colormap according +to its position on the scale defined by the `-l` option (see below, "0,100" by +default). + +`hash` (8 colors) and `Hash` (256 colors) will take a fingerprint of the matching +text and apply the default colormap according to it. This ensure that matching +texts appearing several times will always get the same color. + +Before interpreting the matched string as a number, colout will remove any +character not supposed to be used to write down numbers. This permits to apply +this special color on a large group, while interpreting only its numerical part. + +You can use the name of a syntax-coloring ["lexer"](http://pygments.org/docs/lexers/) +as a color (for example: "Cpp", "ruby", "xml+django", etc.). + +If GIMP palettes files (*.gpl) are available, you can also use their names as a +colormap (see the `-P` switch below). + +Note that the RGB colors (either the hex triplets or the palettes's colors) will +be converted to their nearest ANSI 256 color mode equivalents. + +When not specified, a *COLOR* defaults to _red_ and a *STYLE* defaults to _bold_. + +`colout` comes with some predefined themes to rapidly color well-known outputs +(see the `-t` switch below). + +`colout` can be used as an interface to pygments (see also the `--source` switch below). + +To have a list of all colors, styles, special colormaps, themes, palettes and lexers, +use the `-r` switch (see below). + +`colout` is released under the GNU Public License v3. + + +## Installation + +The recomended method is using pip to install the package for the local user: + +```console +$ pip install --user colout +``` + +Another method is using [pipsi](https://github.com/mitsuhiko/pipsi) +(_pipsi is no longer maintained, _) +```console +$ pipsi install colout +``` + +There is also a PPA for Ubuntu 16.04 (Xenial)/18.04 (Bionic) (@`0.6.1-3~dist7`, not actively maintained) + +```console +$ sudo add-apt-repository ppa:csaba-kertesz/random +$ sudo apt-get update +$ sudo apt-get/aptitude install colout +``` + +## Options + +* `-h`, `--help`: + Show a help message and exit + +* `-g`, `--groups`: + For color maps (like "rainbow"), iterate over matching groups in the pattern instead of over patterns. + +* `-c`, `--colormap`: + Use the given list of comma-separated colors as a colormap (cycle the colors at each match). + +* `-l min,max`, `--scale min,max`: + When using the 'scale' colormap, parse matches as decimal numbers (taking your locale into + account) or as arithmetic expression (like "1+2/0.9*3") and apply the rainbow colormap linearly + between the given min,max (0,100, by default). + +* `-a`, `--all`: + Color the whole input at once instead of line per line + (really useful for coloring a source code file with strings on multiple lines). + +* `-t`, `--theme`: + Interpret PATTERN as a predefined theme (perm, cmake, g++, etc.). + +* `-T DIR`, `--themes-dir DIR`: + Search for additional themes (colout_*.py files) in this directory. + +* `-P DIR`, `--palettes-dir DIR`: + Search for additional palettes (*.gpl files) in this directory. + +* `-d COLORMAP`, `--default COLORMAP`: + When using special colormaps (`random`, `scale` or `hash`), use this COLORMAP instead of the default one. + This can be either one of the available colormaps or a comma-separated list of colors. + WARNING: be sure to specify a default colormap that is compatible with the special colormap's mode, + or else the colors may not appear the same. + Also, external palettes are converted from RGB to 256-ANSI and will thus not work if you use + them as default colormaps for a 8-colors mode special color. + +* `-r [TYPE(S)]`, `--resources [TYPE(S)]`: + Print the names of available resources. Use a comma-separated list of resources names + (styles, colors, special, themes, palettes, colormaps or lexers), + use 'all' (or no argument) to print all resources. + +* `-s`, `--source`: + Interpret PATTERN as source code readable by the Pygments library. If the first letter of PATTERN + is upper case, use the 256 color mode, if it is lower case, use the 8 colors mode. + In 256 color mode, interpret COLOR as a Pygments style (e.g. "default"). + +* `-e CHAR`, `--sep-list CHAR`: + Use this character as a separator for list of colors/resources/numbers (instead of comma). + +* `-E CHAR`, `--sep-pair CHAR`: + Use this character as a separator for foreground/background pairs (instead of period). + +* `--debug`: + Debug mode: print what's going on internally, if you want to check what features are available. + + +## Regular expressions + +A regular expression (or _regex_) is a pattern that describes a set of strings +that matches it. + +`colout` understands regex as specified in the _re_ python module. Given that +`colout` is generally called by the command line, you may have to escape +special characters that would be recognize by your shell. + + +## Dependencies + +Necessary Python modules: + +* `pygments` for the source code syntax coloring +* `babel` for a locale-aware number parsing + + +## Limitations + +Don't use nested groups or colout will duplicate the corresponding input text +with each matching colors. + +Using a default colormap that is incompatible with the special colormap's mode +(i.e. number of colors) will end badly. + +Color pairs (`foreground.background`) work in 8-colors mode for simple coloring, but may fail with `--colormap`. + +## Examples + +### Simple + +* Color in bold red every occurrence of the word _color_ in colout sources: + `cat colout.py | colout color red bold` + +* Color in bold violet home directories in _/etc/passwd_: + `colout '/home/[a-z]+' 135 < /etc/passwd` + +* Color in yellow user/groups id, in bold green name and in bold red home directories in `/etc/passwd`: + `colout ':x:([0-9]+:[0-9]+):([^:]+).*(/home/[a-z]+)' yellow,green,red normal,bold < /etc/passwd` + +* Color in yellow file permissions with read rights for everyone: + `ls -l | colout '.(r.-){3}' yellow normal` + +* Color in green read permission, in bold red write and execution ones: + `ls -l | colout '(r)(w*)(x*)' green,red normal,bold` + +* Color in green comments in colout sources: + `colout '.*(#.*)$' green normal < colout.py` + +* Color in bold green every numbers and in bold red the words _error_ in make output: + `make 2>&1 | colout '[0-9]+' green normal | colout error` + + +### Somewhat useful + +* Use a different color for each line of the auth log + `grep user /var/log/auth.log | colout "^.*$" rainbow` + +* Color each line of a file with a different color among a 256 color gradient from cyan to green: + `head /var/log/auth.log | colout -c "^.*$" 39,38,37,36,35,34` + +* Color permissions with a predefined template: + `ls -l | colout -t perm` + +* Color in light green comments in non-empty colout sources, with the sharp in bold green: + `grep -v '^\s*$' colout.py | colout '.*(#)(.*)$' green,119 bold,normal` + +* Color a make output, line numbers in yellow, errors in bold red, warning in magenta, pragma in green and C++ file base names in cyan: + `make 2>&1 | colout ':([0-9]+):[0-9]*' yellow normal | colout error | colout warning magenta | colout pragma green normal | colout '/(\w+)*\.(h|cpp)' cyan normal` + Or using themes: + `make 2>&1 | colout -t cmake | colout -t g++` + +* Color each word in the head of auth.log with a rainbow color map, starting a new colormap at each new line (the + beginning of the command is just bash magic to repeat the string "(\\w+)\\W+": + `L=$(seq 10) ; P=${L//??/(\\w+)\\W+} ; head /var/log/auth.log | colout -g "^${P}(.*)$" rainbow` + +* Color source code in 8 colors mode, without seeing comments: + `cat colout.py | grep -v "#" | colout -s python` + +* Color source code in 256 color mode: + `cat colout.py | colout -s Python monokai` + +* Color a JSON stream: + `echo '{"foo": "lorem", "bar":"ipsum"}' | python -mjson.tool | colout -t json` + +* Color a source code substring: + `echo "There is an error in 'static void Functor::operator()( EOT& indiv ) { return indiv; }' you should fix it" | colout "'(.*)'" Cpp monokai` + +* Color the percent of progress part of a CMake's makefile output, with a color + related to the value of the progress (from 0%=blue to 100%=red): + `cmake .. && make | colout "^(\[\s*[0-9]+%\])" Scale` + +* Color hosts and users in `auth.log`, with consistent colors: + `cat /var/log/auth.log | colout "^(\S+\s+){3}(\S+)\s(\S+\s+){3}(\S+)\s+(\S+\s+){2}(\S+)\s*" none,hash,none,hash,none,hash` + + +### Bash alias + +The following bash function color the output of any command with the +cmake and g++ themes: + +```bash +function cm() +{ + set -o pipefail + $@ 2>&1 | colout -t cmake | colout -t g++ +} +``` + +You then can use the `cm` alias as a prefix to your build command, +for example: `cm make test` + + +### GDB integration + +You can use `colout` within the GNU debuger (`gbd`) to color its output. +For example, the following script `.gdbinit` configuration will color +the output of the backtrace command: + +```gdb +set confirm off + +# Don't wrap line or the coloring regexp won't work. +set width 0 + +# Create a named pipe to get outputs from gdb +shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe +shell mkfifo /tmp/coloutPipe + +define logging_on + # Instead of printing on stdout only, log everything... + set logging redirect on + # ... in our named pipe. + set logging on /tmp/coloutPipe +end + +define logging_off + set logging off + set logging redirect off + # Because both gdb and our commands are writing on the same pipe at the same + # time, it is more than probable that gdb will end before our (higher level) + # commands. The gdb prompt will thus render before the result of the command, + # which is highly akward. To prevent this, we need to wait before displaying + # the prompt again. The more your commands are complex, the higher you will + # need to set this. + shell sleep 0.4s +end + +define hook-backtrace + # Note: match path = [path]file[.ext] = (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)) + # This line color highlights: + # – lines that link to source code, + # – function call in green, + # – arguments names in yellow, values in magenta, + # — the parent directory in bold red (assuming that the debug session would be in a "project/build/" directory). + shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal | colout "/($(basename $(dirname $(pwd))))/" red bold & + logging_on +end +define hookpost-backtrace + logging_off +end + +# Don't forget to clean the adhoc pipe. +define hook-quit + set confirm off + shell rm -f /tmp/coloutPipe +end +``` + +Take a look at the `example.gdbinit` file distributed with colout for more gdb commands. + + + +### Themes + +You can easily add your own theme to colout. +A theme is basically a module with a function named `theme` that take the configuration context as +an argument and return back the (modified) context and a list of triplets. +Each triplet figures the same arguments than those of the command line interface. + +```python +def theme(context): + return context,[ [regexp, colors, styles] ] +``` + +With the context dictionary at hand, you have access to the internal configuration of colout, you +can thus change colormaps for special keywords, the scale, even the available colors, styles or +themes. + +See the cmake them for how to modify an existing colormap if (and only if) the user didn't ask for an alternative one. +See the ninja theme for how to extend an existing theme with more regexps and a different configuration. +See the gcc theme for an example of how to use the localization of existing softwares to build translated regexp. + + +### Buffering + +Note that when you use colout within real time streams (like `tail -f X | grep Y | colout Z`) of +commands, you may observe that the lines are printed by large chunks and not one by one, in real +time. +This is not due to colout but to the buffering behavior of your shell. + +To fix that, use `stdbuf`, for example: `tail -f X | stdbuf -o0 grep Y | colout Z`. + +## Authors + +* nojhan : original idea, main developer, maintainer. +* Adrian Sadłocha +* Alex Burka +* Brian Foley +* Charles Lewis +* DainDwarf +* Dimitri Merejkowsky +* Dong Wei Ming +* Fabien MARTY +* Jason Green +* John Anderson +* Jonathan Poelen +* Louis-Kenzo Furuya Cahier +* Mantas +* Martin Ueding +* Nicolas Pouillard +* Nurono +* Oliver Bristow +* orzrd <61966225@qq.com> +* Philippe Daouadi +* Piotr Staroszczyk +* Scott Lawrence +* Xu Di +* https://github.com/stdedos: maintainer. diff --git a/apt_update_palette_firecode.png b/apt_update_palette_firecode.png deleted file mode 100644 index 5818b6b..0000000 Binary files a/apt_update_palette_firecode.png and /dev/null differ diff --git a/boot_log_fail_line_red_bold.png b/boot_log_fail_line_red_bold.png deleted file mode 100644 index f718fe0..0000000 Binary files a/boot_log_fail_line_red_bold.png and /dev/null differ diff --git a/boot_log_fail_red_bold.png b/boot_log_fail_red_bold.png deleted file mode 100644 index e3b42aa..0000000 Binary files a/boot_log_fail_red_bold.png and /dev/null differ diff --git a/cmake_scale.png b/cmake_scale.png deleted file mode 100644 index cebcd5e..0000000 Binary files a/cmake_scale.png and /dev/null differ diff --git a/cmake_theme_paradiseo.png b/cmake_theme_paradiseo.png deleted file mode 100644 index 4b42d87..0000000 Binary files a/cmake_theme_paradiseo.png and /dev/null differ diff --git a/code_grep_monokai.png b/code_grep_monokai.png deleted file mode 100644 index 334b505..0000000 Binary files a/code_grep_monokai.png and /dev/null differ diff --git a/colout/__init__.py b/colout/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/colout/colout.py b/colout/colout.py new file mode 100755 index 0000000..2d51fac --- /dev/null +++ b/colout/colout.py @@ -0,0 +1,1095 @@ +#!/usr/bin/env python3 +#encoding: utf-8 + +# Color Up Arbitrary Command Output +# Licensed under the GPL version 3 +# 2012 (c) nojhan + +import os +import re +import sys +import copy +import glob +import math +import pprint +import random +import signal +import string +import hashlib +import logging +import argparse +import importlib +import functools +import babel.numbers as bn + +# set the SIGPIPE handler to kill the program instead of +# ending in a write error when a broken pipe occurs +signal.signal( signal.SIGPIPE, signal.SIG_DFL ) + + +############################################################################### +# Global variable(s) +############################################################################### + +context = {} +debug = False + +# Available styles +context["styles"] = { + "normal": 0, "bold": 1, "faint": 2, "italic": 3, "underline": 4, + "blink": 5, "rapid_blink": 6, + "reverse": 7, "conceal": 8 +} + +error_codes = {"UnknownColor": 1, "DuplicatedPalette": 2, "MixedModes": 3, "UnknownLexer": 4, "UnknownResource": 5} + +# Available color names in 8-colors mode. +eight_colors = ["black","red","green","yellow","blue","magenta","cyan","white"] +# Given in that order, the ASCII code is the index. +eight_color_codes = {n:i for i,n in enumerate(eight_colors)} +# One can add synonyms. +eight_color_codes["orange"] = eight_color_codes["yellow"] +eight_color_codes["purple"] = eight_color_codes["magenta"] + +# Foreground colors has a special "none" item. +# Note: use copy to avoid having the same reference over fore/background. +context["colors"] = copy.copy(eight_color_codes) +context["colors"]["none"] = -1 + +# Background has the same colors than foreground, but without the none code. +context["backgrounds"] = copy.copy(eight_color_codes) + +context["themes"] = {} + +# pre-defined colormaps +# 8-colors mode should start with a lower-case letter (and can contains either named or indexed colors) +# 256-colors mode should start with an upper-case letter (and should contains indexed colors) +context["colormaps"] = { + # Rainbows + "rainbow" : ["magenta", "blue", "cyan", "green", "yellow", "red"], + "Rainbow" : [92, 93, 57, 21, 27, 33, 39, 45, 51, 50, 49, 48, 47, 46, 82, 118, 154, 190, 226, 220, 214, 208, 202, 196], + + # From magenta to red, with white in the middle + "spectrum" : ["magenta", "blue", "cyan", "white", "green", "yellow", "red"], + "Spectrum" : [91, 92, 56, 57, 21, 27, 26, 32, 31, 37, 36, 35, 41, 40, 41, 77, 83, 84, 120, 121, 157, 194, 231, 254, 255, 231, 230, 229, 228, 227, 226, 220, 214, 208, 202, 196], + + # All the colors are available for the default `random` special + "random" : context["colors"], + "Random" : list(range(256)) +} # colormaps + +context["colormaps"]["scale"] = context["colormaps"]["spectrum"] +context["colormaps"]["Scale"] = context["colormaps"]["Spectrum"] +context["colormaps"]["hash"] = context["colormaps"]["rainbow"] +context["colormaps"]["Hash"] = context["colormaps"]["Rainbow"] +context["colormaps"]["default"] = context["colormaps"]["spectrum"] +context["colormaps"]["Default"] = context["colormaps"]["Spectrum"] + +context["user_defined_colormaps"] = False + +context["colormap_idx"] = 0 + +context["scale"] = (0,100) + +context["lexers"] = [] + +# Character use as a delimiter +# between foreground and background. +context["sep_pair"]="." +context["sep_list"]="," + +class UnknownColor(Exception): + pass + +class DuplicatedPalette(Exception): + pass + +class DuplicatedTheme(Exception): + pass + +class MixedModes(Exception): + pass + + +############################################################################### +# Ressource parsing helpers +############################################################################### + +def make_colormap( colors, sep_list = context["sep_list"] ): + cmap = colors.split(sep_list) + + # Check unicity of mode. + modes = [mode(c) for c in cmap] + if len(uniq(modes)) > 1: + # Format a list of color:mode, for error display. + raise MixedModes(", ".join(["%s:%s" % cm for cm in zip(cmap,modes)])) + + return cmap + + +def set_special_colormaps( cmap, sep_list = context["sep_list"] ): + """Change all the special colors to a single colormap (which must be a list of colors).""" + global context + context["colormaps"]["scale"] = cmap + context["colormaps"]["Scale"] = cmap + context["colormaps"]["hash"] = cmap + context["colormaps"]["Hash"] = cmap + context["colormaps"]["default"] = cmap + context["colormaps"]["Default"] = cmap + context["colormaps"]["random"] = cmap + context["colormaps"]["Random"] = cmap + context["user_defined_colormaps"] = True + logging.debug("user-defined special colormap: %s" % sep_list.join([str(i) for i in cmap]) ) + + +def parse_gimp_palette( filename ): + """ + Parse the given filename as a GIMP palette (.gpl) + + Return the filename (without path and extension) and a list of ordered + colors. + Generally, the colors are RGB triplets, thus this function returns: + (name, [ [R0,G0,B0], [R1,G1,B1], ... , [RN,GN,BN] ]) + """ + + logging.debug("parse GIMP palette file: %s" % filename) + fd = open(filename) + # remove path and extension, only keep the file name itself + name = os.path.splitext( os.path.basename(filename ))[0] + + # The first .gpl line is a header + assert( fd.readline().strip() == "GIMP Palette" ) + + # Then the full name of the palette + long_name = fd.readline().strip() + + # Then the columns number. + # split on colon, take the second argument as an int + line = fd.readline() + if "Columns:" in line: + columns = int( line.strip().split(":")[1].strip() ) + lines = fd.readlines() + else: + columns=3 + lines = [line] + fd.readlines() + + # Then the colors themselves. + palette = [] + for line in lines: + # skip lines with only a comment + if re.match(r"^\s*#.*$", line ): + continue + # decode the columns-ths codes. Generally [R G B] followed by a comment + colors = [ int(c) for c in line.split()[:columns] ] + palette.append( colors ) + + logging.debug("parsed %i RGB colors from palette %s" % (len(palette), name) ) + return name,palette + + +def uniq( lst ): + """Build a list with uniques consecutive elements in the argument. + + >>> uniq([1,1,2,2,2,3]) + [1,2,3] + >>> uniq([0,1,1,2,3,3,3]) + [0,1,2,3] + """ + assert( len(lst) > 0 ) + uniq = [ lst[0] ] + for i in range(1,len(lst)): + if lst[i] != lst[i-1]: + uniq.append(lst[i]) + return uniq + + +def rgb_to_ansi( r, g, b ): + """Convert a RGB color to its closest 256-colors ANSI index""" + + # Range limits for the *colored* section of ANSI, + # this does not include the *gray* section. + ansi_min = 16 + ansi_max = 234 + + # ansi_max is the higher possible RGB value for ANSI *colors* + # limit RGB values to ansi_max + red,green,blue = tuple([ansi_max if c>ansi_max else c for c in (r,g,b)]) + + offset = 42.5 + is_gray = True + while is_gray: + if red < offset or green < offset or blue < offset: + all_gray = red < offset and green < offset and blue < offset + is_gray = False + offset += 42.5 + + if all_gray: + val = ansi_max + round( (red + green + blue)/33.0 ) + res = int(val) + else: + val = ansi_min + for color,modulo in zip( [red, green, blue], [6*6, 6, 1] ): + val += round(6.0 * (color / 256.0)) * modulo + res = int(val) + + return res + + +def hex_to_rgb(h): + assert( h[0] == "#" ) + h = h.lstrip('#') + lh = len(h) + return tuple( int(h[i:i+lh//3], 16) for i in range(0, lh, lh//3) ) + + +############################################################################### +# Load available extern resources +############################################################################### + +def load_themes( themes_dir): + global context + logging.debug("search for themes in: %s" % themes_dir) + sys.path.append( themes_dir ) + + # load available themes + for f in glob.iglob(os.path.join(themes_dir, "colout_*.py")): + basename = os.path.basename(f) # Remove path. + module = os.path.splitext(basename)[0] # Remove extension. + name = "_".join(module.split("_")[1:]) # Remove the 'colout_' prefix. + if name in context["themes"]: + raise DuplicatedTheme(name) + logging.debug("load theme %s" % name) + context["themes"][name] = importlib.import_module(module) + + +def load_palettes( palettes_dir, ignore_duplicates = True ): + global context + logging.debug("search for palettes in: %s" % palettes_dir) + + # load available colormaps (GIMP palettes format) + for p in glob.iglob(os.path.join(palettes_dir, "*.gpl")): + try: + name,palette = parse_gimp_palette(p) + except Exception as e: + logging.warning("error while parsing palette %s: %s" % ( p,e ) ) + continue + if name in context["colormaps"]: + if ignore_duplicates: + logging.warning("ignore this duplicated palette name: %s" % name) + else: + raise DuplicatedPalette(name) + # Convert the palette to ANSI + ansi_palette = [ rgb_to_ansi(r,g,b) for r,g,b in palette ] + # Compress it so that there isn't two consecutive identical colors + compressed = uniq(ansi_palette) + logging.debug("load %i ANSI colors in palette %s: %s" % (len(compressed), name, compressed)) + context["colormaps"][name] = compressed + + +def load_lexers(): + global context + # load available pygments lexers + lexers = [] + global get_lexer_by_name + from pygments.lexers import get_lexer_by_name + + global highlight + from pygments import highlight + + global Terminal256Formatter + from pygments.formatters import Terminal256Formatter + + global TerminalFormatter + from pygments.formatters import TerminalFormatter + + from pygments.lexers import get_all_lexers + try: + for lexer in get_all_lexers(): + l = None + # If the tuple has one-word aliases + # (which are usually a better option than the long names + # for a command line argument). + if lexer[1]: + l = lexer[1][0] # Take the first one. + else: + assert(lexer[0]) + l = lexer[0] # Take the long name, which should alway exists. + if not l: + logging.warning("cannot load lexer: %s" % lexer[1][0]) + pass # Forget about this lexer. + else: + assert(" " not in l) # Should be very rare, but probably a source of bugs. + lexers.append(l) + except: + logging.warning("error while executing the pygment module, syntax coloring is not available") + + lexers.sort() + logging.debug("loaded %i lexers: %s" % (len(lexers), ", ".join(lexers))) + + context["lexers"] = lexers + + +def load_resources( themes_dir, palettes_dir ): + load_themes( themes_dir ) + load_palettes( palettes_dir ) + load_lexers() + + +############################################################################### +# Library +############################################################################### + +def mode( color ): + global context + if type(color) is int: + if 0 <= color and color <= 255 : + return 256 + else: + raise UnknownColor(color) + elif color in context["colors"]: + return 8 + elif color in context["colormaps"].keys(): + if color[0].islower(): + return 8 + elif color[0].isupper(): + return 256 + elif color.lower() in ("scale","hash","random") or color.lower() in context["lexers"]: + if color[0].islower(): + return 8 + elif color[0].isupper(): + return 256 + elif color[0] == "#": + return 256 + elif color.isdigit() and (0 <= int(color) and int(color) <= 255) : + return 256 + else: + raise UnknownColor(color) + + +def next_in_map( name ): + global context + # loop over indices in colormap + return (context["colormap_idx"]+1) % len(context["colormaps"][name]) + + +def color_random( color ): + global context + m = mode(color) + if m == 8: + color_name = random.choice(list(context["colormaps"]["random"])) + color_code = context["colors"][color_name] + color_code = str(30 + color_code) + + elif m == 256: + color_nb = random.choice(context["colormaps"]["Random"]) + color_code = str(color_nb) + + return color_code + + +def color_in_colormaps( color ): + global context + m = mode(color) + if m == 8: + c = context["colormaps"][color][context["colormap_idx"]] + if c.isdigit(): + color_code = str(30 + c) + else: + color_code = str(30 + context["colors"][c]) + + else: + color_nb = context["colormaps"][color][context["colormap_idx"]] + color_code = str( color_nb ) + + context["colormap_idx"] = next_in_map(color) + + return color_code + + +def color_scale( name, text ): + # filter out everything that does not seem to be necessary to interpret the string as a number + # this permits to transform "[ 95%]" to "95" before number conversion, + # and thus allows to color a group larger than the matched number + chars_in_numbers = "-+.,e/*" + allowed = string.digits + chars_in_numbers + nb = "".join([i for i in filter(allowed.__contains__, text)]) + + # interpret as decimal + f = None + try: + f = float(bn.parse_decimal(nb)) + except bn.NumberFormatError: + pass + if f is not None: + # normalize with scale if it's a number + f = (f - context["scale"][0]) / (context["scale"][1]-context["scale"][0]) + else: + # interpret as float between 0 and 1 otherwise + f = eval(nb) + + # if out of scale, do not color + if f < 0 or f > 1: + return None + + # normalize and scale over the nb of colors in cmap + colormap = context["colormaps"][name] + i = int( math.ceil( f * (len(colormap)-1) ) ) + color = colormap[i] + + # infer mode from the color in the colormap + m = mode(color) + + if m == 8: + color_code = str(30 + context["colors"][color]) + else: + color_code = str(color) + + return color_code + + +def color_hash( name, text ): + hasher = hashlib.md5() + hasher.update(text.encode('utf-8')) + hash = hasher.hexdigest() + + f = float(functools.reduce(lambda x, y: x+ord(y), hash, 0) % 101) + + # normalize and scale over the nb of colors in cmap + colormap = context["colormaps"][name] + i = int( math.ceil( (f - context["scale"][0]) / (context["scale"][1]-context["scale"][0]) * (len(colormap)-1) ) ) + color = colormap[i] + + # infer mode from the color in the colormap + m = mode(color) + + if m == 8: + color_code = str(30 + context["colors"][color]) + else: + color_code = str(color) + + return color_code + + +def color_map(name): + global context + # current color + color = context["colormaps"][name][ context["colormap_idx"] ] + + m = mode(color) + if m == 8: + color_code = str(30 + context["colors"][color]) + else: + color_nb = int(color) + assert( 0 <= color_nb <= 255 ) + color_code = str(color_nb) + + context["colormap_idx"] = next_in_map(name) + + return color,color_code + + +def color_lexer( name, style, text ): + lexer = get_lexer_by_name(name.lower()) + # Python => 256 colors, python => 8 colors + m = mode(name) + if m == 256: + try: + formatter = Terminal256Formatter(style=style) + except: # style not found + formatter = Terminal256Formatter() + else: + if style not in ("light","dark"): + style = "dark" # dark color scheme by default + formatter = TerminalFormatter(bg=style) + # We should return all but the last character, + # because Pygments adds a newline char. + if not debug: + return highlight(text, lexer, formatter)[:-1] + else: + return "<"+name+">"+ highlight(text, lexer, formatter)[:-1] + "" + + +def colorin(text, color="red", style="normal", sep_pair=context["sep_pair"]): + """ + Return the given text, surrounded by the given color ASCII markers. + + The given color may be either a single name, encoding the foreground color, + or a pair of names, delimited by the given sep_pair, + encoding foreground and background, e.g. "red.blue". + + If the given color is a name that exists in available colors, + a 8-colors mode is assumed, else, a 256-colors mode. + + The given style must exists in the available styles. + + >>> colorin("Fetchez la vache", "red", "bold") + '\x1b[1;31mFetchez la vache\x1b[0m' + >>> colout.colorin("Faites chier la vache", 41, "normal") + '\x1b[0;38;5;41mFaites chier la vache\x1b[0m' + """ + + assert( type(color) is str ) + + global debug + + # Special characters. + start = "\033[" + stop = "\033[0m" + + # Escaped end markers for given color modes + endmarks = {8: ";", 256: ";38;5;"} + + color_code = "" + style_code = "" + background_code = "" + style_codes = [] + + # Convert the style code + if style == "random" or style == "Random": + style = random.choice(list(context["styles"].keys())) + else: + styles = style.split(sep_pair) + for astyle in styles: + if astyle in context["styles"]: + style_codes.append(str(context["styles"][astyle])) + style_code = ";".join(style_codes) + + color_pair = color.strip().split(sep_pair) + color = color_pair[0] + background = color_pair[1] if len(color_pair) == 2 else "none" + + if color == "none" and background == "none": + # if no color, style cannot be applied + if not debug: + return text + else: + return ""+text+"" + + elif color.lower() == "random": + color_code = color_random( color ) + + elif color.lower() == "scale": # "scale" or "Scale" + color_code = color_scale( color, text ) + + # "hash" or "Hash"; useful to randomly but consistently color strings + elif color.lower() == "hash": + color_code = color_hash( color, text ) + + # The user can change the "colormap" variable to its favorite one before calling colorin. + elif color == "colormap": + # "default" should have been set to the user-defined colormap. + color,color_code = color_map("default") + + # Registered colormaps should be tested after special colors, + # because special tags are also registered as colormaps, + # but do not have the same simple behavior. + elif color in context["colormaps"].keys(): + color_code = color_in_colormaps( color ) + + # 8 colors modes + elif color in context["colors"]: + color_code = str(30 + context["colors"][color]) + + # hexadecimal color + elif color[0] == "#": + color_nb = rgb_to_ansi(*hex_to_rgb(color)) + assert(0 <= color_nb <= 255) + color_code = str(color_nb) + + # 256 colors mode + elif color.isdigit(): + color_nb = int(color) + assert(0 <= color_nb <= 255) + color_code = str(color_nb) + + # programming language + elif color.lower() in context["lexers"]: + # bypass color encoding and return text colored by the lexer + return color_lexer(color,style,text) + + # unrecognized + else: + raise UnknownColor(color) + + m = mode(color) + + if background in context["backgrounds"] and m == 8: + background_code = endmarks[m] + str(40 + context["backgrounds"][background]) + elif background == "none": + background_code = "" + else: + raise UnknownColor(background) + + if color_code is not None: + if not debug: + return start + style_code + endmarks[m] + color_code + background_code + "m" + text + stop + else: + return start + style_code + endmarks[m] + color_code + background_code + "m" \ + + "" \ + + text + "" + stop + else: + if not debug: + return text + else: + return "" + text + "" + + +def colorout(text, match, prev_end, color="red", style="normal", group=0): + """ + Build the text from the previous re.match to the current one, + coloring up the matching characters. + """ + start = match.start(group) + colored_text = text[prev_end:start] + end = match.end(group) + + colored_text += colorin(text[start:end], color, style) + return colored_text, end + + +def colorup(text, pattern, color="red", style="normal", on_groups=False, sep_list=context["sep_list"]): + """ + Color up every characters that match the given regexp patterns. + If groups are specified, only color up them and not the whole pattern. + + Colors and styles may be specified as a list of comma-separated values, + in which case the different matching groups may be formatted differently. + If there is less colors/styles than groups, the last format is used + for the additional groups. + """ + + global context + global debug + + if not debug: + regex = re.compile(pattern) + else: + regex = re.compile(pattern, re.DEBUG) + + # Prepare the colored text. + colored_text = "" + end = 0 + for match in regex.finditer(text): + + # If no groups are specified + if not match.groups(): + # Color the previous partial line, + partial, end = colorout(text, match, end, color, style) + # add it to the final text. + colored_text += partial + + else: + nb_groups = len(match.groups()) + + # Build a list of colors that match the number of grouped, + # if there is not enough colors, duplicate the last one. + colors_l = color.split(sep_list) + group_colors = colors_l + [colors_l[-1]] * (nb_groups - len(colors_l)) + + # Same for styles + styles_l = style.split(sep_list) + group_styles = styles_l + [styles_l[-1]] * (nb_groups - len(styles_l)) + + # If we want to iterate colormaps on groups instead of patterns + if on_groups: + # Reset the counter at the beginning of each match + context["colormap_idx"] = 0 + + # For each group index. + # Note that match.groups returns a tuple (thus being indexed in [0,n[), + # but that match.start(0) refers to the whole match, the groups being indexed in [1,n]. + # Thus, we need to range in [1,n+1[. + for group in range(1, nb_groups+1): + # If a group didn't match, there's nothing to color + if match.group(group) is not None: + partial, end = colorout(text, match, end, group_colors[group-1], group_styles[group-1], group) + colored_text += partial + + # Append the remaining part of the text, if any. + colored_text += text[end:] + + return colored_text + + +########### +# Helpers # +########### + +def colortheme(item, theme): + """ + Take a list of list of args to colorup, and color the given item with sequential calls to colorup. + + Used to read themes, which can be something like: + [ [ pattern, colors, styles ], [ pattern ], [ pattern, colors ] ] + """ + # logging.debug("use a theme with %i arguments" % len(theme)) + for args in theme: + item = colorup(item, *args) + return item + + +def write(colored, stream = sys.stdout): + """ + Write "colored" on sys.stdout, then flush. + """ + try: + stream.write(colored) + stream.flush() + + # Silently handle broken pipes + except IOError: + try: + stream.close() + except IOError: + pass + + +def map_write( stream_in, stream_out, function, *args ): + """ + Read the given file-like object as a non-blocking stream + and call the function on each item (line), + with the given extra arguments. + + A call to "map_write(sys.stdin, colorup, pattern, colors)" will translate to the + non-blocking equivalent of: + for item in sys.stdin.readlines(): + write( colorup( item, pattern, colors ) ) + """ + while True: + try: + item = stream_in.readline() + except UnicodeDecodeError: + continue + except KeyboardInterrupt: + break + if not item: + break + write( function(item, *args), stream_out ) + + +def colorgen(stream, pattern, color="red", style="normal", on_groups=False, sep_list=context["sep_list"]): + """ + A generator that colors the items given in an iterable input. + + >>> import math + >>> list(colorgen([str(i) for i in [math.pi,math.e]],"1","red")) + ['3.\x1b[0;31m1\x1b[0m4\x1b[0;31m1\x1b[0m59265359', + '2.7\x1b[0;31m1\x1b[0m828\x1b[0;31m1\x1b[0m82846'] + """ + while True: + try: + item = stream.readline() + except KeyboardInterrupt: + break + if not item: + break + yield colorup(item, pattern, color, style, on_groups, sep_list) + + +###################### +# Command line tools # +###################### + +def _args_parse(argv, usage=""): + """ + Parse command line arguments with the argparse library. + Returns a tuple of (pattern,color,style,on_stderr). + """ + parser = argparse.ArgumentParser( + description=usage) + + parser.add_argument("pattern", metavar="REGEX", type=str, nargs=1, + help="A regular expression") + + pygments_warn=" You can use a language name to activate syntax coloring (see `-r all` for a list)." + + parser.add_argument("color", metavar="COLOR", type=str, nargs='?', + default="red", + help="A number in [0…255], a color name, a colormap name, \ + a palette or a comma-separated list of those values." + pygments_warn) + + parser.add_argument("style", metavar="STYLE", type=str, nargs='?', + default="bold", + help="One of the available styles or a comma-separated list of styles.") + + parser.add_argument("-g", "--groups", action="store_true", + help="For color maps (random, rainbow, etc.), iterate over matching groups \ + in the pattern instead of over patterns") + + parser.add_argument("-c", "--colormap", action="store_true", + help="Interpret the given COLOR comma-separated list of colors as a colormap \ + (cycle the colors at each match)") + + babel_warn=" (numbers will be parsed according to your locale)" + + parser.add_argument("-l", "--scale", metavar="SCALE", + help="When using the 'scale' colormap, parse matches as decimal numbers \ + and apply the rainbow colormap linearly between the given SCALE=min,max" + babel_warn) + + parser.add_argument("-a", "--all", action="store_true", + help="Color the whole input at once instead of line per line \ + (really useful for coloring a source code file with strings \ + on multiple lines).") + + parser.add_argument("-t", "--theme", action="store_true", + help="Interpret REGEX as a theme.") + + parser.add_argument("-T", "--themes-dir", metavar="DIR", action="append", + help="Search for additional themes (colout_*.py files) in the given directory") + + parser.add_argument("-P", "--palettes-dir", metavar="DIR", action="append", + help="Search for additional palettes (*.gpl files) in the given directory") + + parser.add_argument("-d", "--default", metavar="COLORMAP", default=None, + help="When using special colormaps (`random`, `scale` or `hash`), use this COLORMAP. \ + This can be either one of the available colormaps or a comma-separated list of colors. \ + WARNING: be sure to specify a default colormap that is compatible with the special colormap's mode \ + (8 or 256 colors).") + + # This normally should be an option with an argument, but this would end in an error, + # as no regexp is supposed to be passed after calling this option, + # we use it as the argument to this option. + # The only drawback is that the help message lacks a metavar... + parser.add_argument("-r", "--resources", action="store_true", + help="Print the names of available resources. Use a comma-separated list of resources names \ + (styles, colors, special, themes, palettes, colormaps or lexers), \ + use 'all' to print everything.") + + parser.add_argument("-s", "--source", action="store_true", + help="Interpret REGEX as a source code readable by the Pygments library. \ + If the first letter of PATTERN is upper case, use the 256 colors mode, \ + if it is lower case, use the 8 colors mode. \ + Interpret COLOR as a Pygments style." + pygments_warn) + + parser.add_argument("-e", "--sep-list", metavar="CHAR", default=",", type=str, + help="Use this character as a separator for list of colors/resources/numbers (instead of comma).") + + parser.add_argument("-E", "--sep-pair", metavar="CHAR", default=".", type=str, + help="Use this character as a separator for foreground/background pairs (instead of period).") + + parser.add_argument("--debug", action="store_true", + help="Debug mode: print what's going on internally, useful if you want to check what features are available.") + + # HACK: Mock up "--resources ALL" if just "--resources" on command line + if (len(sys.argv) == 2 and (sys.argv[1] in ["-r", "--resources"])): + sys.argv.append("ALL") + + args = parser.parse_args() + + return args.pattern[0], args.color, args.style, args.groups, \ + args.colormap, args.theme, args.source, args.all, args.scale, args.debug, args.resources, args.palettes_dir, \ + args.themes_dir, args.default, args.sep_list, args.sep_pair + + +def write_all( as_all, stream_in, stream_out, function, *args ): + """ + If as_all, print function(*args) on the whole stream, + else, print it for each line. + """ + if as_all: + write( function( stream_in.read(), *args ), stream_out ) + else: + map_write( stream_in, stream_out, function, *args ) + + +def main(): + global context + usage = "A regular expression based formatter that color up an arbitrary text stream." + + ##################### + # Arguments parsing # + ##################### + pattern, color, style, on_groups, as_colormap, as_theme, as_source, as_all, myscale, \ + debug, resources, palettes_dirs, themes_dirs, default_colormap, sep_list, sep_pair \ + = _args_parse(sys.argv, usage) + + if debug: + lvl = logging.DEBUG + else: + lvl = logging.ERROR + + logging.basicConfig(format='[colout] %(levelname)s: %(message)s', level=lvl) + + + ################## + # Load resources # + ################## + + context["sep_list"] = sep_list + logging.debug("Color list separator: '%s'" % context["sep_list"]) + context["sep_pair"] = sep_pair + logging.debug("Color pair separator: '%s'" % context["sep_pair"]) + + try: + # Search for available resources files (themes, palettes) + # in the same dir as the colout.py script + res_dir = os.path.dirname(os.path.realpath(__file__)) + + # this must be called before args parsing, because the help can list available resources + load_resources( res_dir, res_dir ) + + # try additional directories if asked + if palettes_dirs: + for adir in palettes_dirs: + if os.path.isdir(adir): + load_palettes( adir ) + else: + logging.warning("cannot read palettes directory %s, ignore it" % adir) + + if themes_dirs: + for adir in themes_dirs: + if os.path.isdir(adir): + load_themes( adir ) + else: + logging.warning("cannot read themes directory %s, ignore it" % adir) + + except DuplicatedPalette as e: + logging.error( "duplicated palette file name: %s" % e ) + sys.exit( error_codes["DuplicatedPalette"] ) + + # if debug: + # setting = pprint.pformat(context, depth=2) + # logging.debug(setting) + + if resources: + asked=[r.lower() for r in pattern.split(context["sep_list"])] + + def join_sort( l ): + """ + Sort the given list in lexicographical order, + with upper-cases first, then lower cases + join the list with a comma. + + >>> join_sort(["a","B","A","b"]) + 'A, a, B, b' + """ + return ", ".join(sorted(l, key=lambda s: s.lower()+s)) + + # print("Available resources:") + resources_not_found = [] + for res in asked: + resource_found = False + + if "style" in res or "all" in res: + print("STYLES: %s" % join_sort(context["styles"]) ) + resource_found = True + + if "color" in res or "all" in res: + print("COLORS: %s" % join_sort(context["colors"]) ) + resource_found = True + + if "special" in res or "all" in res: + print("SPECIAL: %s" % join_sort(["random", "Random", "scale", "Scale", "hash", "Hash", "colormap"]) ) + resource_found = True + + if "theme" in res or "all" in res: + if len(context["themes"]) > 0: + print("THEMES: %s" % join_sort(context["themes"].keys()) ) + else: + print("NO THEME") + resource_found = True + + if "colormap" in res or "all" in res: + if len(context["colormaps"]) > 0: + print("COLORMAPS: %s" % join_sort(context["colormaps"]) ) + else: + print("NO COLORMAPS") + resource_found = True + + if "lexer" in res or "all" in res: + if len(context["lexers"]) > 0: + print("SYNTAX COLORING: %s" % join_sort(context["lexers"]) ) + else: + print("NO SYNTAX COLORING (check that python3-pygments is installed)") + resource_found = True + + if not resource_found: + resources_not_found.append(res) + + if resources_not_found: + logging.error( "Unknown resources: %s" % ", ".join(resources_not_found) ) + sys.exit( error_codes["UnknownResource"] ) + + sys.exit(0) # not an error, we asked for help + + ############ + # Coloring # + ############ + + try: + if myscale: + context["scale"] = tuple([float(i) for i in myscale.split(context["sep_list"])]) + logging.debug("user-defined scale: %f,%f" % context["scale"]) + + # Default color maps + if default_colormap: + if default_colormap not in context["colormaps"]: + cmap = make_colormap(default_colormap,context["sep_list"]) + + elif default_colormap in context["colormaps"]: + cmap = context["colormaps"][default_colormap] + + set_special_colormaps( cmap, context["sep_list"] ) + + # explicit color map + if as_colormap is True and color not in context["colormaps"]: + context["colormaps"]["Default"] = make_colormap(color,context["sep_list"]) # replace the colormap by the given colors + context["colormaps"]["default"] = make_colormap(color,context["sep_list"]) # replace the colormap by the given colors + color = "colormap" # use the keyword to switch to colormap instead of list of colors + logging.debug("used-defined default colormap: %s" % context["sep_list"].join(context["colormaps"]["Default"]) ) + + # if theme + if as_theme: + logging.debug( "asked for theme: %s" % pattern ) + assert(pattern in context["themes"].keys()) + context,theme = context["themes"][pattern].theme(context) + write_all( as_all, sys.stdin, sys.stdout, colortheme, theme ) + + # if pygments + elif as_source: + logging.debug("asked for lexer: %s" % pattern.lower()) + if pattern.lower() not in context["lexers"]: + logging.error("Lexer %r is not available. Run with \"--resources all\" to see the options.") + sys.exit(error_codes["UnknownLexer"]) + lexer = get_lexer_by_name(pattern.lower()) + # Python => 256 colors, python => 8 colors + ask_256 = pattern[0].isupper() + if ask_256: + logging.debug("256 colors mode") + try: + formatter = Terminal256Formatter(style=color) + except: # style not found + logging.warning("style %s not found, fallback to default style" % color) + formatter = Terminal256Formatter() + else: + logging.debug("8 colors mode") + formatter = TerminalFormatter() + + write_all( as_all, sys.stdin, sys.stdout, highlight, lexer, formatter ) + + # if color + else: + write_all( as_all, sys.stdin, sys.stdout, colorup, pattern, color, style, on_groups, context["sep_list"] ) + + except UnknownColor as e: + if debug: + import traceback + print(traceback.format_exc()) + logging.error("Unknown color: %s (maybe you forgot to install python3-pygments?)" % e ) + sys.exit( error_codes["UnknownColor"] ) + + except MixedModes as e: + logging.error("You cannot mix up color modes when defining your own colormap." \ + + " Check the following 'color:mode' pairs: %s." % e ) + sys.exit( error_codes["MixedModes"] ) + + +if __name__ == "__main__": + main() diff --git a/colout/colout_catch2.py b/colout/colout_catch2.py new file mode 100644 index 0000000..e67d86a --- /dev/null +++ b/colout/colout_catch2.py @@ -0,0 +1,23 @@ +def theme(context): + + return context,[ + ["^ (Start)(.*): (.*):(.*)$", "yellow", "normal,normal,normal,bold"], # Test start. + # path file ext:line : + ["^(tests): (/.*?)/([^/:]+):([0-9]+): (.*)", "yellow,none,white,yellow,red", "bold,normal,bold,normal,bold"], + ["(`)(.*)('.*)", "red,Cpp,red", "bold,normal,bold"], + [r"^\.+$", "yellow", "bold"], + ["^=+$", "yellow", "bold"], + ["(/.*?)/([^/:]+):([0-9]+): (FAILED):", "white,white,yellow,red", "normal,bold,normal,bold"], + [r"(REQUIRE\(|CHECK\(|REQUIRE_THAT\()(.*)(\))$","yellow,Cpp,yellow","bold,normal,bold"], + # Hide uninteresting stuff: + ["[0-9]+/[0-9]+ Test.*","blue"], + ["^Filters:.*","blue"], + ["^Randomness seeded to:.*","blue"], + ["^tests is a Catch2.*","blue"], + ["^Run with.*", "blue"], + ["^~+$","blue"], + ["^-+$","blue"], + [r"^\s*(Scenario:|Given:|When:|Then:).*","blue"], + ["^(/.*?)/([^/:]+):([0-9]+)", "blue"], + ["^(test cases|assertions)(.*)", "blue"], + ] diff --git a/colout/colout_clang.py b/colout/colout_clang.py new file mode 100644 index 0000000..a5525ef --- /dev/null +++ b/colout/colout_clang.py @@ -0,0 +1,85 @@ +#encoding: utf-8 + +def default_gettext( msg ): + return msg + +def theme(context): + import os + import gettext + import locale + + section="blue" + + # get g++ version + gv = os.popen("g++ -dumpversion").read().strip() + + # get the current translations of gcc + try: + t = gettext.translation("gcc-"+gv) + except IOError: + _ = default_gettext + else: + _ = t.gettext + # _("msg") will return the given message, translated + + # if the locale is unicode + enc = locale.getpreferredencoding() + if "UTF" in enc: + # gcc will use unicode quotes + qo = "[‘`]" + qc = "[’']" + else: + # rather than ascii ones + qo = "['`]" + qc = "'" + + return context,[ + # Command line + [ r"[/\s]([cg]\+\+-*[0-9]*\.*[0-9]*)", "white", "bold" ], + [ r"\s(\-D)(\s*[^\s]+)", "none,green", "normal,bold" ], + [ r"\s(-g)", "green", "normal" ], + [ r"\s-O[0-4]", "green", "normal" ], + [ r"\s-[Wf][^\s]*", "magenta", "normal" ], + [ r"\s-pedantic", "magenta", "normal" ], + [ r"\s(-I)(/*[^\s]+/)([^/\s]+)", "none,blue", "normal,normal,bold" ], + [ r"\s(-L)(/*[^\s]+/)([^/\s]+)", "none,cyan", "normal,normal,bold" ], + [ r"\s(-l)([^/\s]+)", "none,cyan", "normal,bold" ], + [ r"\s-[oc]", "red", "bold" ], + [ r"\s(-+std(?:lib)?)=?([^\s]+)", "red", "normal,bold" ], + + # Important messages + [ _("error: "), "red", "bold" ], + [ _("fatal error: "), "red", "bold" ], + [ _("warning: "), "magenta", "bold" ], + [ _("undefined reference to "), "red", "bold" ], + # [-Wflag] + [ r"\[-W.*\]", "magenta"], + + # Highlight message start: + # path file ext : line : col … + [ "(/.*?)/([^/:]+): (In .*)"+qo, + section, + "normal,normal,bold" ], + + [ "(/.*?)/([^/:]+): (At .*)", + section, + "normal,normal,bold" ], + + [ _("In file included from"), section ], + + # Highlight locations: + # path file ext : line : col … + [ "(/.*?)/([^/:]+):([0-9]+):*([0-9]*)(.*)", + "none,white,yellow,none,none", + "normal,normal,normal,normal" ], + + # source code in single quotes + [ qo+"(.*?)"+qc, "Cpp", "monokai" ], + + # source code after a "note: candidate are/is:" + [ _("note: ")+"((?!.*("+qo+"|"+qc+")).*)$", "Cpp", "monokai" ], + # [ _("note: ")+"(candidate:)(.*)$", "green,Cpp", "normal,monokai" ], + # after the code part, to avoid matching ANSI escape chars + [ _("note: "), "green", "normal" ] + ] + diff --git a/colout/colout_cmake.py b/colout/colout_cmake.py new file mode 100644 index 0000000..66ab5a8 --- /dev/null +++ b/colout/colout_cmake.py @@ -0,0 +1,55 @@ + +def theme(context): + # CMake theme: + # actions performing in cyan + performing="cyan" + # actions performed in green + performed="green" + # actions taking an unknown time + untimed="blue" + + # If the user do not ask for his own colormap + if not context["user_defined_colormaps"]: + # A palette that goes: purple, orange, white + percs = [45, 39, 33, 27, 21, 57, 63, 62, 98, 97, 133, 132, 138, 173, 172, 208, 214, 220, 226, 228, 229, 230, 231, 255] + context["colormaps"]["Scale"] = percs + + return context,[ + # Configure... + [ "^--.*works", performed ], + [ "^--.*done", performed ], + [ "^-- Found.*NO", "red" ], + [ "^-- Found.*", performed ], + [ "^--.*broken", "red" ], + [ "^-- Coult NOT find.*", "red" ], + [ "^-- Configuring incomplete, errors occurred!", "red" ], + [ "^--.*", performing ], + # Errors + [ "CMake Error", "red" ], + [ "CMake Warning", "magenta" ], + [ "CMake Deprecation Warning", "magenta" ], + # Scan + [ "^(Scanning dependencies of target)(.*)$", + performing, "normal,bold" ], + # Link (make) + # [ "^(Linking .* )(library|executable) (.*/)*(.+(\.[aso]+)*)$", + [ "^(Linking .* )(library|executable) (.*)$", + untimed, "normal,normal,bold" ], + # [percent] Creating something + [ r"^\[\s*[0-9/]+%?\]\s(.*Creating.*)$", + performing, "normal" ], + # [percent] Built + [ r"^\[\s*[0-9/]+%?\]\s(Built target)(\s.*)$", + performed, "normal,bold" ], + # [percent] Building + [ r"^\[\s*[0-9/]+%?\]\s(Building \w* object)\s+(.*)(\.dir)(.*/)([-\w]+).c.*.o$", + performing+","+performing+","+performing+",Hash,"+performing, "normal,normal,normal,normal,bold"], + # [percent] Generating + [ r"^\[\s*[0-9/]+%?\]\s(Generating)(\s+.*)$", + performing, "normal,bold"], + # make errors + [ r"make\[[0-9]+\].*", "yellow"], + [ r"(make: \*\*\* \[.+\] )(.* [0-9]+)", "red", "normal,bold"], + # progress percentage (make) + [ r"^(\[\s*[0-9]+%\])","Scale" ] + ] diff --git a/colout/colout_configure.py b/colout/colout_configure.py new file mode 100644 index 0000000..63e63a4 --- /dev/null +++ b/colout/colout_configure.py @@ -0,0 +1,16 @@ +#encoding: utf-8 + +def theme(context): + + return context, [ + ["^(checking .*)(yes|found|ok)$","green", "normal,bold"], + ["^(checking .*)(no|none)$", "yellow", "normal,bold"], + ["^(configure:) (error:)(.*)", "red","normal,bold"], + ["^(configure:)(.*)", "magenta","normal,bold"], + ["^(checking .*)", "blue",""], + ["^(config.status:) (creating|linking)(.*)", "cyan,blue","normal,normal,bold"], + ["^(config.status:) (executing )(.*)", "cyan,green","normal,normal,bold"], + ["^(config.status:) (.*)(is unchanged)", "cyan,green","normal,normal,bold"], + [r"^\s*(Build.*)(yes)$","green", "normal,bold"], + [r"^\s*(Build.*)(no)$","yellow", "normal,bold"], + ] diff --git a/colout/colout_ctest.py b/colout/colout_ctest.py new file mode 100644 index 0000000..f2dd372 --- /dev/null +++ b/colout/colout_ctest.py @@ -0,0 +1,19 @@ + +def theme(context): + # CTest theme: + passed="green" + notrun="yellow" + notpassed="red" + + # If the user do not ask for his own colormap + # if not context["user_defined_colormaps"]: + # # A palette that goes: purple, orange, white + # percs = [45, 39, 33, 27, 21, 57, 63, 62, 98, 97, 133, 132, 138, 173, 172, 208, 214, 220, 226, 228, 229, 230, 231, 255] + # context["colormaps"]["Scale"] = percs + + return context,[ + # Passed + [ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+\s+(Passed)", "blue,"+passed], + [ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(\*{3}Not Run.*)\s+.*", "blue,"+notrun], + [ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(.*\*{3}.*)\s+.*", "blue,"+notpassed], + ] diff --git a/colout/colout_django.py b/colout/colout_django.py new file mode 100644 index 0000000..fcacc00 --- /dev/null +++ b/colout/colout_django.py @@ -0,0 +1,36 @@ + +def theme(context): + return context,[ + # Waiting + ["^Waiting for .*$", "red", "bold"], + [".*Sending.*", "green"], + # Watches + [r"^(Watching) (\S*) (.*)", "yellow", "bold,bold,normal"], + [".*reloading.$","yellow"], + # File from python/lib + [r"^(File) (/.*/lib/python[^/]*/site-packages/)([^/]*)\S* (first seen) (with mtime [0-9]*.*)$", + "blue,blue,white,blue,blue", "bold,normal,bold,bold,normal"], + # File from app (last 3 name highlighted) + [r"^(File) (/\S*/)(\S*/\S*/)(\S*) (first seen) (with mtime [0-9]*.*)$", + "magenta,magenta,white,white,magenta,magenta", "bold,normal,normal,bold,bold,normal"], + # SQL + ["(.*)(SELECT)(.*)(FROM)(.*)", + "green", "normal,bold,normal,bold,normal"], + ["(.*)(SELECT)(.*)(FROM)(.*)(WHERE)(.*)", + "green", "normal,bold,normal,bold,normal,bold,normal"], + # HTTP + [r"\"(GET) (\S*) (HTTP\S*)\" ([0-9]+) (.*)$", + "green,white,green,green,green", "bold,bold,normal,bold,normal"], + # Errors + ["(Exception) (while .*) '(.*)' (in) (.*) '(.*)'", "red,red,white,red,red,white", "bold,normal,bold,bold,normal,bold"], + ["(.*Error): (.*) '(.*)'", "red,red,white", "bold,normal,bold"], + [r"(django[^:\s]*)\.([^.:\s]*): (.*)", "red","normal,bold,normal"], + ["Traceback.*:","yellow"], + ["During handling.*","yellow"], + # File, line, in + [ + r"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$", + "blue, none, white,blue, yellow,blue", + "normal,normal,bold, normal,normal,bold" + ], + ] diff --git a/colout/colout_g++.py b/colout/colout_g++.py new file mode 100644 index 0000000..a5525ef --- /dev/null +++ b/colout/colout_g++.py @@ -0,0 +1,85 @@ +#encoding: utf-8 + +def default_gettext( msg ): + return msg + +def theme(context): + import os + import gettext + import locale + + section="blue" + + # get g++ version + gv = os.popen("g++ -dumpversion").read().strip() + + # get the current translations of gcc + try: + t = gettext.translation("gcc-"+gv) + except IOError: + _ = default_gettext + else: + _ = t.gettext + # _("msg") will return the given message, translated + + # if the locale is unicode + enc = locale.getpreferredencoding() + if "UTF" in enc: + # gcc will use unicode quotes + qo = "[‘`]" + qc = "[’']" + else: + # rather than ascii ones + qo = "['`]" + qc = "'" + + return context,[ + # Command line + [ r"[/\s]([cg]\+\+-*[0-9]*\.*[0-9]*)", "white", "bold" ], + [ r"\s(\-D)(\s*[^\s]+)", "none,green", "normal,bold" ], + [ r"\s(-g)", "green", "normal" ], + [ r"\s-O[0-4]", "green", "normal" ], + [ r"\s-[Wf][^\s]*", "magenta", "normal" ], + [ r"\s-pedantic", "magenta", "normal" ], + [ r"\s(-I)(/*[^\s]+/)([^/\s]+)", "none,blue", "normal,normal,bold" ], + [ r"\s(-L)(/*[^\s]+/)([^/\s]+)", "none,cyan", "normal,normal,bold" ], + [ r"\s(-l)([^/\s]+)", "none,cyan", "normal,bold" ], + [ r"\s-[oc]", "red", "bold" ], + [ r"\s(-+std(?:lib)?)=?([^\s]+)", "red", "normal,bold" ], + + # Important messages + [ _("error: "), "red", "bold" ], + [ _("fatal error: "), "red", "bold" ], + [ _("warning: "), "magenta", "bold" ], + [ _("undefined reference to "), "red", "bold" ], + # [-Wflag] + [ r"\[-W.*\]", "magenta"], + + # Highlight message start: + # path file ext : line : col … + [ "(/.*?)/([^/:]+): (In .*)"+qo, + section, + "normal,normal,bold" ], + + [ "(/.*?)/([^/:]+): (At .*)", + section, + "normal,normal,bold" ], + + [ _("In file included from"), section ], + + # Highlight locations: + # path file ext : line : col … + [ "(/.*?)/([^/:]+):([0-9]+):*([0-9]*)(.*)", + "none,white,yellow,none,none", + "normal,normal,normal,normal" ], + + # source code in single quotes + [ qo+"(.*?)"+qc, "Cpp", "monokai" ], + + # source code after a "note: candidate are/is:" + [ _("note: ")+"((?!.*("+qo+"|"+qc+")).*)$", "Cpp", "monokai" ], + # [ _("note: ")+"(candidate:)(.*)$", "green,Cpp", "normal,monokai" ], + # after the code part, to avoid matching ANSI escape chars + [ _("note: "), "green", "normal" ] + ] + diff --git a/colout/colout_javac.py b/colout/colout_javac.py new file mode 100644 index 0000000..92e5a2c --- /dev/null +++ b/colout/colout_javac.py @@ -0,0 +1,15 @@ +#encoding: utf-8 + +def theme(context): + style="monokai" + return context,[ + [ r"^(.*\.java):([0-9]+):\s*(warning:.*)$", "white,yellow,magenta", "normal,normal,bold" ], + [ r"^(.*\.java):([0-9]+):(.*)$", "white,yellow,red", "normal,normal,bold" ], + [ r"^(symbol|location)\s*:\s*(.*)$", "blue,Java", "bold,"+style ], + [ r"^(found)\s*:\s*(.*)", "red,Java", "bold,"+style ], + [ r"^(required)\s*:\s*(.*)", "green,Java", "bold,"+style ], + [ r"^\s*\^$", "cyan", "bold" ], + [ r"^\s+.*$", "Java", style ], + [ "[0-9]+ error[s]*", "red", "bold" ], + [ "[0-9]+ warning[s]*", "magenta", "bold" ], + ] diff --git a/colout/colout_json.py b/colout/colout_json.py new file mode 100644 index 0000000..2f9898e --- /dev/null +++ b/colout/colout_json.py @@ -0,0 +1,13 @@ + +def theme(context): + # This theme expect a formatted JSON input, with items spread across lines. + # See tools like "python -m json.tool" or "json_xs" + return context,[ + [ r'[\[\]{}],*\s*\n' ], + [ '" (:) ', "yellow" ], + [ r'[\]}"](,)', "yellow" ], + [ r"\"(-*[0-9]+\.*[0-9]*e*-*[0-9]*)\"", "blue" ], + [ '"(.*)"', "green" ], + [ """["']""", "cyan" ] + ] + diff --git a/colout/colout_latex.py b/colout/colout_latex.py new file mode 100644 index 0000000..5567fbd --- /dev/null +++ b/colout/colout_latex.py @@ -0,0 +1,30 @@ + +def theme(context): + return context,[ + # LaTeX + ["This is .*TeX.*$", "white", "bold"], + ["(LaTeX Warning): (.*) `(.*)' on page [0-9] (.*) on input line [0-9]+.$", + "magenta,magenta,white,magenta", "normal,bold,normal" ], + ["(LaTeX Warning): (.*)", "magenta", "normal,bold" ], + ["(LaTeX Error): (.*)", "red", "normal,bold" ], + [r"^(.*\.tex):([0-9]+): (.*)", "white,yellow,red", "normal,normal,bold" ], + # ["on (page [0-9]+)", "yellow", "normal" ], + ["on input (line [0-9]+)", "yellow", "normal" ], + ["^! .*$", "red", "bold"], + [r"(.*erfull) ([^\s]+).* in [^\s]+ at (lines [0-9]+--[0-9]+)", + "magenta,magenta,yellow", "normal"], + [r"\\[^\s]+\s", "white", "bold"], + [r"^l\.([0-9]+) (.*)", "yellow,tex"], + [r"^\s+(.*)", "tex"], + [r"(Output written on) (.*) \(([0-9]+ pages), [0-9]+ bytes\).", + "blue,white,blue", "normal,bold,normal"], + ["WARNING.*", "magenta", "normal"], + ["[wW]arning.*", "magenta", "normal"], + ["No pages of output", "red", "bold"], + + # BiBTeX + ["^(I couldn't) (.*)", "red", "normal,bold"], + ["(I found) no (.*)", "red"], + ["^---(line [0-9]+) of file (.*)", "yellow,white", "normal"], + ] + diff --git a/colout/colout_ninja.py b/colout/colout_ninja.py new file mode 100644 index 0000000..34dd9ec --- /dev/null +++ b/colout/colout_ninja.py @@ -0,0 +1,19 @@ + +import colout_cmake + +def theme(context): + # Ninja theme + + # Inherit from the CMake theme + context,th = colout_cmake.theme(context) + + # Because Ninja note progress as a fraction, we do not want the scale of a percentage + context["scale"] = (0,1) + + # Link (ninja) + th.append( [ r"^\[[0-9/]+\]\s?(Linking .* )(library|executable) (.*/)*(.+(\.[aso]+)*)$", + "blue", "normal,normal,bold" ] ) + # progress percentage (ninja) + th.append( [ r"^(\[[0-9]+/[0-9]+\])","Scale" ] ) + + return context,th diff --git a/colout/colout_perm.py b/colout/colout_perm.py new file mode 100644 index 0000000..048230c --- /dev/null +++ b/colout/colout_perm.py @@ -0,0 +1,8 @@ + +def theme(context): + p="([-rwxsStT])" + reg=r"^([-dpcCDlMmpPs?])"+p*9+r"\s.*$" + colors="blue"+",green"*3+",yellow"*3+",red"*3 + styles="normal"+ ",normal,italic,bold"*3 + return context,[ [reg, colors, styles] ] + diff --git a/colout/colout_python.py b/colout/colout_python.py new file mode 100644 index 0000000..40e4b34 --- /dev/null +++ b/colout/colout_python.py @@ -0,0 +1,20 @@ + +def theme(context): + return context,[ + # traceback header + ["^Traceback .*$", "blue" ], + # File, line, in + [ + r"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$", + "blue, none, white,blue, yellow,blue", + "normal,normal,bold, normal,normal,bold" + ], + # [r"^\s{2}File \"(.*)\", line ([0-9]+), in (.*)$", "white,yellow,white", "normal,normal,bold" ], + # Error name + ["^([A-Za-z]*Error):*", "red", "bold" ], + ["^([A-Za-z]*Exception):*", "red", "bold" ], + # any quoted things + [r"Error.*['\"](.*)['\"]", "magenta" ], + # python code + [r"^\s{4}.*$", "Python", "monokai" ], + ] diff --git a/colout/colout_slurm.py b/colout/colout_slurm.py new file mode 100644 index 0000000..9f5af8d --- /dev/null +++ b/colout/colout_slurm.py @@ -0,0 +1,117 @@ + +def theme(context): + # SLURM's states (from squeue manual). + + col_width = 9 + + COMPLETED =r"\bCOMPLETED" + PENDING =r"\bPENDING" + RUNNING =r"\bRUNNING" + CONFIGURING =r"\bCONFIGURING" + COMPLETING =r"\bCOMPLETING" + FAILED =r"\bFAILED" + DEADLINE =r"\bDEADLINE" + OUT_OF_MEMORY=r"\bOUT_OF_MEMORY" + TIMEOUT =r"\bTIMEOUT" + CANCELLED =r"\bCANCELLED" + BOOT_FAIL =r"\bBOOT_FAIL" + NODE_FAIL =r"\bNODE_FAIL" + PREEMPTED =r"\bPREEMPTED" + RESV_DEL_HOLD=r"\bRESV_DEL_HOLD" + REQUEUE_FED =r"\bREQUEUE_FED" + REQUEUE_HOLD =r"\bREQUEUE_HOLD" + REQUEUED =r"\bREQUEUED" + RESIZING =r"\bRESIZING" + REVOKED =r"\bREVOKED" + SIGNALING =r"\bSIGNALING" + SPECIAL_EXIT =r"\bSPECIAL_EXIT" + STAGE_OUT =r"\bSTAGE_OUT" + STOPPED =r"\bSTOPPED" + SUSPENDED =r"\bSUSPENDED" + + return context,[ + + ## No problem: greens + + #Job has terminated all processes on all nodes with an exit code of zero. + [r"\bCD\b", "22"], + [COMPLETED[0:col_width]+r"\w*\b", "22"], + #Job is awaiting resource allocation. + [r"\bPD\b", "28"], + [PENDING[0:col_width]+r"\w*\b", "28"], + #Job currently has an allocation. + [r"\bR\b", "34"], + [RUNNING[0:col_width]+r"\w*\b", "34"], + #Job has been allocated resources, but are waiting for them to become ready for use (e.g. booting). + [r"\bCF\b", "58"], + [CONFIGURING[0:col_width]+r"\w*\b", "58"], + #Job is in the process of completing. Some processes on some nodes may still be active. + [r"\bCG\b", "23"], + [COMPLETING[0:col_width]+r"\w*\b", "23"], + + ## Problem for the user: bold reds + + #Job terminated with non-zero exit code or other failure condition. + [r"\bF\b", "196"], + [FAILED[0:col_width]+r"\w*\b", "196", "bold"], + #Job terminated on deadline. + [r"\bDL\b", "160"], + [DEADLINE[0:col_width]+r"\w*\b", "160", "bold"], + #Job experienced out of memory error. + [r"\bOO\b", "197"], + [OUT_OF_MEMORY[0:col_width]+r"\w*\b", "197", "bold"], + #Job terminated upon reaching its time limit. + [r"\bTO\b", "161"], + [TIMEOUT[0:col_width]+r"\w*\b", "161", "bold"], + + ## Problem for the sysadmin: oranges + + #Job was explicitly cancelled by the user or system administrator. The job may or may not have been initiated. + [r"\bCA\b", "202"], + [CANCELLED[0:col_width]+r"\w*\b", "202", "bold"], + #Job terminated due to launch failure, typically due to a hardware failure (e.g. unable to boot the node or block and the job can not be requeued). + [r"\bBF\b", "166"], + [BOOT_FAIL[0:col_width]+r"\w*\b", "166"], + #Job terminated due to failure of one or more allocated nodes. + [r"\bNF\b", "208"], + [NODE_FAIL[0:col_width]+r"\w*\b", "208"], + + ## Non-blocking events: blues + + #Job terminated due to preemption. + [r"\bPR\b", "105"], + [PREEMPTED[0:col_width]+r"\w*\b", "105", "bold"], + #Job is being held after requested reservation was deleted. + [r"\bRD\b", "25"], + [RESV_DEL_HOLD[0:col_width]+r"\w*\b", "25"], + #Job is being requeued by a federation. + [r"\bRF\b", "26"], + [REQUEUE_FED[0:col_width]+r"\w*\b", "26"], + #Held job is being requeued. + [r"\bRH\b", "27"], + [REQUEUE_HOLD[0:col_width]+r"\w*\b", "27"], + #Completing job is being requeued. + [r"\bRQ\b", "31"], + [REQUEUED[0:col_width]+r"\w*\b", "31"], + #Job is about to change size. + [r"\bRS\b", "32"], + [RESIZING[0:col_width]+r"\w*\b", "32"], + #Sibling was removed from cluster due to other cluster starting the job. + [r"\bRV\b", "33"], + [REVOKED[0:col_width]+r"\w*\b", "33"], + #Job is being signaled. + [r"\bSI\b", "37"], + [SIGNALING[0:col_width]+r"\w*\b", "37"], + #The job was requeued in a special state. This state can be set by users, typically in EpilogSlurmctld, if the job has terminated with a particular exit value. + [r"\bSE\b", "38"], + [SPECIAL_EXIT[0:col_width]+r"\w*\b", "38"], + #Job is staging out files. + [r"\bSO\b", "39"], + [STAGE_OUT[0:col_width]+r"\w*\b", "39"], + #Job has an allocation, but execution has been stopped with SIGSTOP signal. CPUS have been retained by this job. + [r"\bST\b", "44"], + [STOPPED[0:col_width]+r"\w*\b", "44"], + #Job has an allocation, but execution has been suspended and CPUs have been released for other jobs. + [r"\bS\b", "45"], + [SUSPENDED[0:col_width]+r"\w*\b", "45"], + ] diff --git a/colout/colout_valgrind.py b/colout/colout_valgrind.py new file mode 100644 index 0000000..7fc33a2 --- /dev/null +++ b/colout/colout_valgrind.py @@ -0,0 +1,33 @@ +#encoding: utf-8 + +def theme(context): + + return context, [ + # section title + [r"^(==[0-9]+==\s{1})(Memcheck|Copyright|Using)(.*)$","blue",""], + [r"^(==[0-9]+==\s{1})(Warning)(.*)$","magenta",""], + [r"^(==[0-9]+==\s{1}Command: )(\S*)(.*)$","green,white","normal,bold,normal"], + [r"^(==[0-9]+==\s{1})(HEAP SUMMARY:)(.*)$","green",""], + [r"^(==[0-9]+==\s{1})(All heap blocks were freed)(.*)$","green",""], + [r"^(==[0-9]+==\s{1})(.*[rR]erun.*)$","blue",""], + [r"^(==[0-9]+==\s{1})(Use --.*)$","blue",""], + [r"^(==[0-9]+==\s{1}\S+.*)$","red",""], + # section explanation + [r"^==[0-9]+==\s{2}(\S+.*)$","orange",""], + # locations adresses + [r"^==[0-9]+==\s{4}([atby]{2}) (0x0): (\?{3})", + "blue,yellow,red", "normal,normal,bold"], + [r"^==[0-9]+==\s{4}([atby]{2}) (0x)([^:]*:) (\S+)", + "blue,blue,blue,none", "normal"], + # locations: library + [r"\(in (.*)\)", "cyan", "normal"], + # locations: file + [r"\(([^\.]*\.[^:]+):([0-9]+)\)", "white,yellow", "bold,normal"], + # leak summary + [r"^==[0-9]+==\s{4}(definitely lost): .* (in) .*","red","bold"], + [r"^==[0-9]+==\s{4}(indirectly lost): .* (in) .*","orange","bold"], + [r"^==[0-9]+==\s{6}(possibly lost): .* (in) .*","yellow","bold"], + [r"^==[0-9]+==\s{4}(still reachable): .* (in) .*","green","bold"], + [r"^==[0-9]+==\s{9}(suppressed): .* (in) .*","cyan","bold"], + ] + diff --git a/colout/colout_vivado.py b/colout/colout_vivado.py new file mode 100644 index 0000000..aa74216 --- /dev/null +++ b/colout/colout_vivado.py @@ -0,0 +1,26 @@ + +def theme(context): + # Theme for coloring AMD/Xilinx Vivado IDE synthesis and implementation output + return context,[ + [ r"^\s*\*+.+$", "green" ], + [ "^#.+", "green" ], + + [ "^.+ Checksum: .+$", "green" ], + + [ r"^.+Time \(s\).+", "green" ], + [ r"^Time \(s\).+", "green" ], + + [ r"Estimated Timing Summary \|.+\|.+\|", "cyan", "bold" ], + [ r"Intermediate Timing Summary \|.+\|.+\|", "cyan", "bold" ], + + [ "^INFO:", "white", "bold" ], + [ "^WARNING:.+$", "yellow" ], + [ "^CRITICAL WARNING:.+$", "red" ], + [ "^ERROR:.+$", "red" ], + + [ "^Phase [0-9]+.[0-9]+.[0-9]+.[0-9]+.+$", "magenta", "bold" ], + [ "^Phase [0-9]+.[0-9]+.[0-9]+.+$", "magenta", "bold" ], + [ "^Phase [0-9]+.[0-9]+.+$", "magenta", "bold" ], + [ "^Phase [0-9]+.+$", "magenta", "bold" ] + ] + diff --git a/colout/example.gdbinit b/colout/example.gdbinit new file mode 100644 index 0000000..e4c3116 --- /dev/null +++ b/colout/example.gdbinit @@ -0,0 +1,104 @@ + +# Don't wrap line or the coloring regexp won't work. +set width 0 + +# Create a named pipe to get outputs from gdb +shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe +shell mkfifo /tmp/coloutPipe + +# A yellow prompt +set prompt \033[0;33mgdb>>>\033[0m + +define logging_on + # Instead of printing on stdout only, log everything... + set logging redirect on + # ... in our named pipe. + set logging on /tmp/coloutPipe +end + +define logging_off + set logging off + set logging redirect off + # Because both gdb and our commands are writing on the same pipe at the same + # time, it is more than probable that gdb will end before our (higher level) + # commands. The gdb prompt will thus render before the result of the command, + # which is highly akward. To prevent this, we need to wait before displaying + # the prompt again. The more your commands are complex, the higher you will + # need to set this. + shell sleep 0.4s +end + + +define hook-break + # Don't forget to run the command in the background + shell cat /tmp/coloutPipe | colout "(Breakpoint) ([0-9]+) at (0x\S+): file (.+/)([^/]+), line ([0-9]+)." blue,red,cyan,none,white,yellow normal,bold,normal,normal,bold,normal & + # You should start to consume the pipe before actually redirecting the command output into it. + logging_on +end +define hookpost-break + logging_off +end + + +define hook-run + shell cat /tmp/coloutPipe | colout "^(Breakpoint) ([0-9]+),*\s+(0x\S+ )*(in )*(\S+) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^(Starting program): (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" green,none,white,white,yellow normal,normal,bold,bold,bold | colout "^[0-9]+\s+(.*)$" Cpp & + logging_on +end +define hookpost-run + logging_off +end + + +define hook-continue + shell cat /tmp/coloutPipe | colout "^(Program received signal )(.*)(,.*)$" yellow,red,yellow bold | colout "^(Breakpoint) ([0-9]+),*\s+(0x\S+ )*(in )*(\S+) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^[0-9]+\s+(.*)$" Cpp & + logging_on +end +define hookpost-continue + logging_off +end + + +# Full syntax highlighting for the `list` command. +define hook-list + shell cat /tmp/coloutPipe | colout --all --source Cpp & + logging_on +end +# Don't forget the hookpost- or next coloring commands will fail. +define hookpost-list + logging_off +end + + +define hook-backtrace + # match the [path]file[.ext]: (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)) + shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(\S+) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold & + logging_on +end +define hookpost-backtrace + logging_off +end + + +define info hook-breakpoints + shell cat /tmp/coloutPipe | colout "^([0-9]+)" red bold | colout "\sy\s" green | colout "\sn\s" red | colout "breakpoint" green normal | colout "watchpoint" orange normal | colout "\s0x\S+\s" blue normal | colout "(.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)$" none,white,white,yellow normal,bold & + logging_on +end +define info hookpost-breakpoints + logging_off +end + + +define info hook-line + shell cat /tmp/coloutPipe | colout "^Line ([0-9]+) of \"(.*/)?(?:$|(.+?)(?:(\.[^.]*)|))\"" yellow,none,white,white bold | colout "(0x\S+) <(\S+)\+([0-9]+)>" blue,green,blue normal & + logging_on +end +define info hookpost-line + logging_off +end + + +# Don't forget to clean the adhoc pipe. +define hook-quit + shell rm -f /tmp/coloutPipe +end + diff --git a/colout/jet72.gpl b/colout/jet72.gpl new file mode 100644 index 0000000..ac69f16 --- /dev/null +++ b/colout/jet72.gpl @@ -0,0 +1,77 @@ +GIMP Palette +Name: MATLAB Jet (72) +Columns: 3 +# + 0 0 127 0 + 0 0 127 #1 + 0 0 141 #2 + 0 0 155 #3 + 0 0 169 #4 + 0 0 183 #5 + 0 0 198 #6 + 0 0 212 #7 + 0 0 226 #8 + 0 0 240 #9 + 0 0 255 #10 + 0 14 255 #11 + 0 28 255 #12 + 0 42 255 #13 + 0 56 255 #14 + 0 70 255 #15 + 0 84 255 #16 + 0 98 255 #17 + 0 112 255 #18 + 0 127 255 #19 + 0 141 255 #20 + 0 155 255 #21 + 0 169 255 #22 + 0 183 255 #23 + 0 198 255 #24 + 0 212 255 #25 + 0 226 255 #26 + 0 240 255 #27 + 0 255 255 #28 + 14 255 240 #29 + 28 255 226 #30 + 42 255 212 #31 + 56 255 198 #32 + 70 255 183 #33 + 84 255 169 #34 + 98 255 155 #35 +112 255 141 #36 +127 255 127 #37 +141 255 112 #38 +155 255 98 #39 +169 255 84 #40 +183 255 70 #41 +198 255 56 #42 +212 255 42 #43 +226 255 28 #44 +240 255 14 #45 +255 255 0 #46 +255 240 0 #47 +255 226 0 #48 +255 212 0 #49 +255 198 0 #50 +255 183 0 #51 +255 169 0 #52 +255 155 0 #53 +255 141 0 #54 +255 127 0 #55 +255 112 0 #56 +255 98 0 #57 +255 84 0 #58 +255 70 0 #59 +255 56 0 #60 +255 42 0 #61 +255 28 0 #62 +255 14 0 #63 +255 0 0 #64 +240 0 0 #65 +226 0 0 #66 +212 0 0 #67 +198 0 0 #68 +183 0 0 #69 +169 0 0 #70 +155 0 0 #71 +141 0 0 #72 diff --git a/colout_logo.svg b/colout_logo.svg new file mode 100644 index 0000000..8db7984 --- /dev/null +++ b/colout_logo.svg @@ -0,0 +1,612 @@ + + + + + colout logo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + colout logo + 2022-08-31 + + + nojhan + + + + + + diff --git a/dmesg_Random.png b/dmesg_Random.png deleted file mode 100644 index 18dccec..0000000 Binary files a/dmesg_Random.png and /dev/null differ diff --git a/example.gdbinit b/example.gdbinit new file mode 100644 index 0000000..b40a960 --- /dev/null +++ b/example.gdbinit @@ -0,0 +1,132 @@ + +set confirm off + +# Reversed yellow >>>, underlined green frame name, yellow »»» +set extended-prompt \[\e[7;33m\]>>>\[\e[0m\]\[\] \[\e[4;32m\]\f\[\e[0m\]\[\]\[\e[0;33m\] \n»»» \[\e[0m\] + + +# Don't wrap line or the coloring regexp won't work. +set width 0 + +# Create a named pipe to get outputs from gdb +shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe +shell mkfifo /tmp/coloutPipe + +define logging_on + # Instead of printing on stdout only, log everything... + set logging redirect on + # ... in our named pipe. + set logging on /tmp/coloutPipe +end + +define logging_off + set logging off + set logging redirect off + # Because both gdb and our commands are writing on the same pipe at the same + # time, it is more than probable that gdb will end before our (higher level) + # commands. The gdb prompt will thus render before the result of the command, + # which is highly akward. To prevent this, we need to wait before displaying + # the prompt again. The more your commands are complex, the higher you will + # need to set this. + shell sleep 0.4s +end + + +define hook-break + # Don't forget to run the command in the background + shell cat /tmp/coloutPipe | colout "(Breakpoint) ([0-9]+) at (0x\S+): file (.+/)([^/]+), line ([0-9]+)." blue,red,cyan,none,white,yellow normal,bold,normal,normal,bold,normal & + # You should start to consume the pipe before actually redirecting the command output into it. + logging_on +end +define hookpost-break + logging_off +end + + +define hook-run + shell cat /tmp/coloutPipe | colout "^(Program received signal )(.+), (.+).$" yellow,red,yellow normal,bold | colout "^(Breakpoint) ([0-9]+),*\s+(0x\S+ )*(in )*(\S+) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^(Starting program): (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" green,none,white,white,yellow normal,normal,bold,bold,bold | colout "^[0-9]+\s+(.*)$" Cpp & + logging_on +end +define hookpost-run + logging_off +end + + +define hook-continue + shell cat /tmp/coloutPipe | colout "^(Program received signal )(.*)(,.*)$" yellow,red,yellow bold | colout "^(Breakpoint) ([0-9]+),*\s+(0x\S+ )*(in )*(\S+) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^[0-9]+\s+(.*)$" Cpp & + logging_on +end +define hookpost-continue + logging_off +end + + +# Full syntax highlighting for the `list` command. +define hook-list + #shell cat /tmp/coloutPipe | colout --all --source cpp & + shell cat /tmp/coloutPipe | colout "^([0-9]+)\s*(.*)$" red,Cpp & + logging_on +end +# Don't forget the hookpost- or next coloring commands will fail. +define hookpost-list + logging_off +end + + +define hook-backtrace + # Note: match path = [path]file[.ext] = (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)) + # This line color highlights: + # – lines that link to source code, + # – function call in green, + # – arguments names in yellow, values in magenta, + # — the parent directory in bold red (assuming that the debug session would be in a "project/build/" directory). + shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal | colout "/($(basename $(dirname $(pwd))))/" red bold & + logging_on +end +define hookpost-backtrace + logging_off +end + + +define info hook-breakpoints + shell cat /tmp/coloutPipe | colout "^([0-9]+)" red bold | colout "\sy\s" green | colout "\sn\s" red | colout "breakpoint" green normal | colout "watchpoint" orange normal | colout "\s0x\S+\s" blue normal | colout "(.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)$" none,white,white,yellow normal,bold & + logging_on +end +define info hookpost-breakpoints + logging_off +end + + +define info hook-line + shell cat /tmp/coloutPipe | colout "^Line ([0-9]+) of \"(.*/)?(?:$|(.+?)(?:(\.[^.]*)|))\"" yellow,none,white,white bold | colout "(0x\S+) <(\S+)\+([0-9]+)>" blue,green,blue normal & + logging_on +end +define info hookpost-line + logging_off +end + + +define hook-frame + #shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,red,magenta,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^([0-9]+)\s+(.*)$" yellow,Cpp & + shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal & + logging_on +end +define hookpost-frame + logging_off +end + +# Don't forget to clean the adhoc pipe. +define hook-quit + set confirm off + shell rm -f /tmp/coloutPipe +end + +define hook-display + shell cat /tmp/coloutPipe | colout "^([0-9]+)(:) (.+?) (=) " red,blue,white,blue normal,normal,bold,normal | colout "(@)(0x\S+)(:)" red,blue,red normal & + logging_on +end +define hookpost-display + logging_off +end + + diff --git a/fonts/OpenSans-Bold-webfont.eot b/fonts/OpenSans-Bold-webfont.eot deleted file mode 100644 index e1c7674..0000000 Binary files a/fonts/OpenSans-Bold-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-Bold-webfont.svg b/fonts/OpenSans-Bold-webfont.svg deleted file mode 100644 index 364b368..0000000 --- a/fonts/OpenSans-Bold-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-Bold-webfont.ttf b/fonts/OpenSans-Bold-webfont.ttf deleted file mode 100644 index 2d94f06..0000000 Binary files a/fonts/OpenSans-Bold-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-Bold-webfont.woff b/fonts/OpenSans-Bold-webfont.woff deleted file mode 100644 index cd86852..0000000 Binary files a/fonts/OpenSans-Bold-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-BoldItalic-webfont.eot b/fonts/OpenSans-BoldItalic-webfont.eot deleted file mode 100644 index f44ac9a..0000000 Binary files a/fonts/OpenSans-BoldItalic-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-BoldItalic-webfont.svg b/fonts/OpenSans-BoldItalic-webfont.svg deleted file mode 100644 index 8392240..0000000 --- a/fonts/OpenSans-BoldItalic-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-BoldItalic-webfont.ttf b/fonts/OpenSans-BoldItalic-webfont.ttf deleted file mode 100644 index f74e0e3..0000000 Binary files a/fonts/OpenSans-BoldItalic-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-BoldItalic-webfont.woff b/fonts/OpenSans-BoldItalic-webfont.woff deleted file mode 100644 index f3248c1..0000000 Binary files a/fonts/OpenSans-BoldItalic-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-Italic-webfont.eot b/fonts/OpenSans-Italic-webfont.eot deleted file mode 100644 index 277c189..0000000 Binary files a/fonts/OpenSans-Italic-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-Italic-webfont.svg b/fonts/OpenSans-Italic-webfont.svg deleted file mode 100644 index 29c7497..0000000 --- a/fonts/OpenSans-Italic-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-Italic-webfont.ttf b/fonts/OpenSans-Italic-webfont.ttf deleted file mode 100644 index 63f187e..0000000 Binary files a/fonts/OpenSans-Italic-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-Italic-webfont.woff b/fonts/OpenSans-Italic-webfont.woff deleted file mode 100644 index 469a29b..0000000 Binary files a/fonts/OpenSans-Italic-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-Light-webfont.eot b/fonts/OpenSans-Light-webfont.eot deleted file mode 100644 index 837daab..0000000 Binary files a/fonts/OpenSans-Light-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-Light-webfont.svg b/fonts/OpenSans-Light-webfont.svg deleted file mode 100644 index bdb6726..0000000 --- a/fonts/OpenSans-Light-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-Light-webfont.ttf b/fonts/OpenSans-Light-webfont.ttf deleted file mode 100644 index b50ef9d..0000000 Binary files a/fonts/OpenSans-Light-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-Light-webfont.woff b/fonts/OpenSans-Light-webfont.woff deleted file mode 100644 index 99514d1..0000000 Binary files a/fonts/OpenSans-Light-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-LightItalic-webfont.eot b/fonts/OpenSans-LightItalic-webfont.eot deleted file mode 100644 index f0ebf2c..0000000 Binary files a/fonts/OpenSans-LightItalic-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-LightItalic-webfont.svg b/fonts/OpenSans-LightItalic-webfont.svg deleted file mode 100644 index 60765da..0000000 --- a/fonts/OpenSans-LightItalic-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-LightItalic-webfont.ttf b/fonts/OpenSans-LightItalic-webfont.ttf deleted file mode 100644 index 5898c8c..0000000 Binary files a/fonts/OpenSans-LightItalic-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-LightItalic-webfont.woff b/fonts/OpenSans-LightItalic-webfont.woff deleted file mode 100644 index 9c978dc..0000000 Binary files a/fonts/OpenSans-LightItalic-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-Regular-webfont.eot b/fonts/OpenSans-Regular-webfont.eot deleted file mode 100644 index dd6fd2c..0000000 Binary files a/fonts/OpenSans-Regular-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-Regular-webfont.svg b/fonts/OpenSans-Regular-webfont.svg deleted file mode 100644 index 01038bb..0000000 --- a/fonts/OpenSans-Regular-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-Regular-webfont.ttf b/fonts/OpenSans-Regular-webfont.ttf deleted file mode 100644 index 05951e7..0000000 Binary files a/fonts/OpenSans-Regular-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-Regular-webfont.woff b/fonts/OpenSans-Regular-webfont.woff deleted file mode 100644 index 274664b..0000000 Binary files a/fonts/OpenSans-Regular-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-Semibold-webfont.eot b/fonts/OpenSans-Semibold-webfont.eot deleted file mode 100644 index 289aade..0000000 Binary files a/fonts/OpenSans-Semibold-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-Semibold-webfont.svg b/fonts/OpenSans-Semibold-webfont.svg deleted file mode 100644 index cc2ca42..0000000 --- a/fonts/OpenSans-Semibold-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 2011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-Semibold-webfont.ttf b/fonts/OpenSans-Semibold-webfont.ttf deleted file mode 100644 index 6f15073..0000000 Binary files a/fonts/OpenSans-Semibold-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-Semibold-webfont.woff b/fonts/OpenSans-Semibold-webfont.woff deleted file mode 100644 index 4e47cb1..0000000 Binary files a/fonts/OpenSans-Semibold-webfont.woff and /dev/null differ diff --git a/fonts/OpenSans-SemiboldItalic-webfont.eot b/fonts/OpenSans-SemiboldItalic-webfont.eot deleted file mode 100644 index 50a8a6f..0000000 Binary files a/fonts/OpenSans-SemiboldItalic-webfont.eot and /dev/null differ diff --git a/fonts/OpenSans-SemiboldItalic-webfont.svg b/fonts/OpenSans-SemiboldItalic-webfont.svg deleted file mode 100644 index 65b50e2..0000000 --- a/fonts/OpenSans-SemiboldItalic-webfont.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fonts/OpenSans-SemiboldItalic-webfont.ttf b/fonts/OpenSans-SemiboldItalic-webfont.ttf deleted file mode 100644 index 55ba312..0000000 Binary files a/fonts/OpenSans-SemiboldItalic-webfont.ttf and /dev/null differ diff --git a/fonts/OpenSans-SemiboldItalic-webfont.woff b/fonts/OpenSans-SemiboldItalic-webfont.woff deleted file mode 100644 index 0adc6df..0000000 Binary files a/fonts/OpenSans-SemiboldItalic-webfont.woff and /dev/null differ diff --git a/gdb_colout.png b/gdb_colout.png deleted file mode 100644 index 30b7d80..0000000 Binary files a/gdb_colout.png and /dev/null differ diff --git a/images/bullet.png b/images/bullet.png deleted file mode 100644 index 22ea543..0000000 Binary files a/images/bullet.png and /dev/null differ diff --git a/images/hr.gif b/images/hr.gif deleted file mode 100644 index bdb4168..0000000 Binary files a/images/hr.gif and /dev/null differ diff --git a/images/nav-bg.gif b/images/nav-bg.gif deleted file mode 100644 index 4743965..0000000 Binary files a/images/nav-bg.gif and /dev/null differ diff --git a/index.html b/index.html deleted file mode 100644 index 386de5a..0000000 --- a/index.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - Colout by nojhan - - - - - - - - - - - - -
- -
-
-

Colout

-

Color Up Arbitrary Command Output

-
- Project maintained by nojhan - Hosted on GitHub Pages — Theme by mattgraham -
- - -

colout

- -

Introduction

- -

colout is a simple command to add colors to a text stream in your terminal.

- -

The colout command line interface has been carefully designed to be simple. Basically, you will call it like: <text -stream> | colout <pattern to color> [color [style]]

- -

colout has the ability to use 8 colors mode, 256 colors mode, colormaps, themes and source code syntax coloring. -Patterns are regular expressions.

- -

You can think of colout as an alternative to grep --color which will preserve the surrounding context, whith more -powerful coloring capabilites.

- - -

Useful examples

- -

Basic coloring

- -

In the most simple use, you just have to call colout word to highlight what you want to spot in a text stream. This is -particularly useful when examining logs.

- -

Color every occurence of the word "fail" in bold red, in the boot log:

-

tail /var/log/boot.log | colout fail

- -

- -

Using regular expressions, you can highlight anything you want in a text stream.

- -

Color every line containing the word "fail" in bold red, in the boot log:

-

tail /var/log/boot.log | colout "^.*fail.*$" red bold

- -

- -

Color in blue the user name of the ps output that have been greped:

-

ps aux | grep firefox | colout "^\w+\s" blue

- -

- - -

Multiple colors

- -

Using groups in the regular expressions, you can highlight several matchs in different colors.

- -

Highlight the different parts of the permissions of files in your home directories, that are rwx for user and group, -but r-x for others:

-

ls -l ~ | colout "^(d*)-*(rwx)(rwx)(r-x)" blue,red,yellow,green

- -

- - -

Color maps

- -

Using colormaps, you can change the colors for each lines

- -

Predefined colormaps are particularly useful for reading logs that have long -lines that are wrapped.

-

tail /var/log/kern.log | colout "^.*$" rainbow

- -

- -

But you can also create your own colormap, using the -c switch, for example to alternate two colors:

-

tail /var/log/kern.log | colout -c "^.*$" blue,yellow normal

- -

- -

If you prefer a rainbow with more colors, just use an upper-case R. For example to color a progress bar:

-

echo "Progress [########################] 100%" | colout "#" Rainbow

- -

- -

If you want even more colors, you can highlight each line of your log with a random one among the 256 ANSI colors:

-

tail /var/log/dmesg | colout "^.*$" Random

- -

- -

You can color numbers according to their value on a linear scale:

-

cmake .. && make 2>&1 | colout --scale 0,100 "\[(.*)%\]" scale

- -

- -

You can even fill your screen with esoteric disco characters (not that useful, but fun):

-

cat /dev/urandom | colout "." Random

- -

- - -

Palettes

- -

You can load extern palettes as colormaps. colout supports the GIMP Palette format (*.gpl, used by GIMP and inkscape, -for instance) and will translate them from their RGB values to their nearest ANSI colors (which may thus contains -fewer colors than the orginal RGB palette).

- -

sudo apt-get update | colout -P /usr/share/gimp/2.0/palettes/ "^.*$" Firecode

-

- - -

Source code

- -

You can use colout as a basic proxy to the pygments library, if you want to highlight a source code.

- -

For example, let say you want to have a quick look at a source file, without being bothered by comments and empty lines:

-

tail colout.py | grep -v "#" | grep -v "^\s*$" | colout -s Python monokai

- -

- -

But even more interesting, you can highlight the syntax of the matching parts of your text stream, which is useful -for spotting code in a log.

- -

For example, color the code parts in the output of g++ (they come inside single quotes):

-

make 2>&1 | colout "'.*'" Cpp vim

- -

- - -

Themes

- -

colout comes with a set of handy shortcuts for coloring common outputs.

- -

For example, if you often build your software with cmake but find its coloring scheme a bit boring, you can use the -following shortcut: -

make 2>&1 | colout -t cmake

- -

- -

You can, of course, combine several calls to colout using pipes: -

make 2>&1 | colout -t cmake | colout -t g++

- -

- - -

Tips

- -

To be able to use the syntax highlighting, you should install the python-pygments library.

- -

colout -r will give you the lists of available colors, colormaps, themes and supported programming languages.

- -

Colormaps and source code syntax highlighting most often comes in 8 or 256 colors mode. Use a lower case first letter -for the 8 colors mode and an upper case first one for the 256 colors.

- -

The 8 colors mode syntax highlighting only comes in two styles: light and dark. If you want more fancy styles, you -should use 256 colors mode, and thus upper case the first letter of the language name, or else the style is ignored.

- -

You can leave simple words without quotes, but it is better to put the regexp in quotes to avoid escaping special -characters that would overwise be interpreted by your shell (like parenthesis).

- -

Do not hesitate to design your own theme, they are defined as separated files, and basically are just like chaining -several calls to colout in pipes, with the possibility to use python code around.

- -

Don't use nested groups or colout will duplicate the corresponding input text with each matching colors.

- -
- -
- - - - diff --git a/index.md b/index.md deleted file mode 100644 index e25a661..0000000 --- a/index.md +++ /dev/null @@ -1,133 +0,0 @@ - -# colout - -## Introduction - -colout is a simple command to add colors to a text stream in your terminal. - -The `colout` command line interface has been carefully designed to be simple. Basically, you will call it like: ` | colout [color [style]]`. - -colout has the ability to use 8 colors mode, 256 colors mode, colormaps, themes and source code syntax coloring. -Patterns are regular expressions. - -You can think of colout as an alternative to `grep --color` which will preserve the surrounding context, whith more -powerful coloring capabilites. - - -## Useful examples - -### Basic coloring - -In the most simple use, you just have to call `colout word` to highlight what you want to spot in a text stream. This is -particularly useful when examining logs. - -Color every occurence of the word "fail" in bold red, in the boot log: -`tail /var/log/boot.log | colout fail` - -![](boot_log_fail_red_bold.png) - -Using regular expressions, you can highlight anything you want in a text stream. - -Color every _line_ containing the word "fail" in bold red, in the boot log: -`tail /var/log/boot.log | colout "^.*fail.*$" red bold` - -![](boot_log_fail_line_red_bold.png) - -Color in blue the user name of the `ps` output that have been greped: -`ps aux | grep firefox | colout "^\w+\s" blue` - -![](ps_grep_firefox_user_blue.png) - - -### Multiple colors - -Using groups in the regular expressions, you can highlight several matchs in different colors. - -Highlight the different parts of the permissions of files in your home directories, that are `rwx` for user and group, -but `r-x` for others: -`ls -l ~ | colout "^(d*)-*(rwx)(rwx)(r-x)" blue,red,yellow,green` - -![](ll_perms_groups_4_colors.png) - -Using colormaps, you can change the colors for each lines, this is particularly useful for reading logs that have long -lines that are wrapped. -`tail /var/log/kern.log | colout "^.*$" rainbow` - -![](kern_log_rainbow.png) - -If you want more colors, you can highlight each line of your log with a random one among the 256 ANSI colors: -`tail /var/log/dmesg | colout "^.*$" Random` - -![](dmesg_Random.png) - -You can even fill your screen with esoteric disco characters (not _that_ useful, but fun): -`cat /dev/urandom | colout "." Random` - -![](urandom_character.png) - - -### Source code - -You can use colout as a basic proxy to the pygments library, if you want to highlight a source code. - -For example, let say you want to have a quick look at a source file, without being bothered by comments and empty lines: -`tail colout.py | grep -v "#" | grep -v "^\s*$" | colout -s Python monokai` - -![](code_grep_monokai.png) - -But even more interesting, you can highlight the syntax of the matching parts of your text stream, which is useful -for spotting code in a log. - -For example, color the code parts in the output of `g++` (they come inside single quotes): -`make 2>&1 | colout "'.*'" Cpp vim` - -![](make_Cpp_vim.png) - - -### Themes - -colout comes with a set of handy shortcuts for coloring common outputs. - -For example, if you often build your software with `cmake` but find its coloring scheme a bit boring, you can use the -following shortcut: -`make 2>&1 | colout -t cmake` - -![](cmake_theme_paradiseo.png) - -You can colorize almost any text stream to make it more readable, see this comparison of the output of Valgrind: - -![](valgrind_colout.png) - -You can, of course, combine several calls to colout using pipes: -`make 2>&1 | colout -t cmake | colout -t g++` - -![](themes_cmake_g++_paradiseo.png) - -As colout is a KISS tool, you can even use it in hacks involving the shell, -like colorizing the output of GDB commands: - -![](gdb_colout.png) - -Try the `example.gdbinit` shipped with colout (copy/link it as `~/.gdbinit`). - - -## Tips - -To be able to use the syntax highlighting, you should install the `python-pygments` library. - -`colout -h` will give you the lists of available colors, themes and programming languages. - -Colormaps and source code syntax highlighting most often comes in 8 or 256 colors mode. Use a lower case first letter -for the 8 colors mode and an upper case first one for the 256 colors. - -The 8 colors mode syntax highlighting only comes in two styles: light and dark. If you want more fancy styles, you -should use 256 colors mode, and thus upper case the first letter of the language name, or else the style is ignored. - -You can leave simple words without quotes, but it is better to put the regexp in quotes to avoid escaping special -characters that would overwise be interpreted -by your shell (like parenthesis). - -Do not hesitate to design your own theme, they are defined as separated files, and basically are just like chaining -several calls to colout in pipes, with the possibility to use python code around. - diff --git a/javascripts/respond.js b/javascripts/respond.js deleted file mode 100644 index 76bc260..0000000 --- a/javascripts/respond.js +++ /dev/null @@ -1,779 +0,0 @@ -if(typeof Object.create!=="function"){ -Object.create=function(o){ -function F(){ -}; -F.prototype=o; -return new F(); -}; -} -var ua={toString:function(){ -return navigator.userAgent; -},test:function(s){ -return this.toString().toLowerCase().indexOf(s.toLowerCase())>-1; -}}; -ua.version=(ua.toString().toLowerCase().match(/[\s\S]+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1]; -ua.webkit=ua.test("webkit"); -ua.gecko=ua.test("gecko")&&!ua.webkit; -ua.opera=ua.test("opera"); -ua.ie=ua.test("msie")&&!ua.opera; -ua.ie6=ua.ie&&document.compatMode&&typeof document.documentElement.style.maxHeight==="undefined"; -ua.ie7=ua.ie&&document.documentElement&&typeof document.documentElement.style.maxHeight!=="undefined"&&typeof XDomainRequest==="undefined"; -ua.ie8=ua.ie&&typeof XDomainRequest!=="undefined"; -var domReady=function(){ -var _1=[]; -var _2=function(){ -if(!arguments.callee.done){ -arguments.callee.done=true; -for(var i=0;i<_1.length;i++){ -_1[i](); -} -} -}; -if(document.addEventListener){ -document.addEventListener("DOMContentLoaded",_2,false); -} -if(ua.ie){ -(function(){ -try{ -document.documentElement.doScroll("left"); -} -catch(e){ -setTimeout(arguments.callee,50); -return; -} -_2(); -})(); -document.onreadystatechange=function(){ -if(document.readyState==="complete"){ -document.onreadystatechange=null; -_2(); -} -}; -} -if(ua.webkit&&document.readyState){ -(function(){ -if(document.readyState!=="loading"){ -_2(); -}else{ -setTimeout(arguments.callee,10); -} -})(); -} -window.onload=_2; -return function(fn){ -if(typeof fn==="function"){ -_1[_1.length]=fn; -} -return fn; -}; -}(); -var cssHelper=function(){ -var _3={BLOCKS:/[^\s{][^{]*\{(?:[^{}]*\{[^{}]*\}[^{}]*|[^{}]*)*\}/g,BLOCKS_INSIDE:/[^\s{][^{]*\{[^{}]*\}/g,DECLARATIONS:/[a-zA-Z\-]+[^;]*:[^;]+;/g,RELATIVE_URLS:/url\(['"]?([^\/\)'"][^:\)'"]+)['"]?\)/g,REDUNDANT_COMPONENTS:/(?:\/\*([^*\\\\]|\*(?!\/))+\*\/|@import[^;]+;)/g,REDUNDANT_WHITESPACE:/\s*(,|:|;|\{|\})\s*/g,MORE_WHITESPACE:/\s{2,}/g,FINAL_SEMICOLONS:/;\}/g,NOT_WHITESPACE:/\S+/g}; -var _4,_5=false; -var _6=[]; -var _7=function(fn){ -if(typeof fn==="function"){ -_6[_6.length]=fn; -} -}; -var _8=function(){ -for(var i=0;i<_6.length;i++){ -_6[i](_4); -} -}; -var _9={}; -var _a=function(n,v){ -if(_9[n]){ -var _b=_9[n].listeners; -if(_b){ -for(var i=0;i<_b.length;i++){ -_b[i](v); -} -} -} -}; -var _c=function(_d,_e,_f){ -if(ua.ie&&!window.XMLHttpRequest){ -window.XMLHttpRequest=function(){ -return new ActiveXObject("Microsoft.XMLHTTP"); -}; -} -if(!XMLHttpRequest){ -return ""; -} -var r=new XMLHttpRequest(); -try{ -r.open("get",_d,true); -r.setRequestHeader("X_REQUESTED_WITH","XMLHttpRequest"); -} -catch(e){ -_f(); -return; -} -var _10=false; -setTimeout(function(){ -_10=true; -},5000); -document.documentElement.style.cursor="progress"; -r.onreadystatechange=function(){ -if(r.readyState===4&&!_10){ -if(!r.status&&location.protocol==="file:"||(r.status>=200&&r.status<300)||r.status===304||navigator.userAgent.indexOf("Safari")>-1&&typeof r.status==="undefined"){ -_e(r.responseText); -}else{ -_f(); -} -document.documentElement.style.cursor=""; -r=null; -} -}; -r.send(""); -}; -var _11=function(_12){ -_12=_12.replace(_3.REDUNDANT_COMPONENTS,""); -_12=_12.replace(_3.REDUNDANT_WHITESPACE,"$1"); -_12=_12.replace(_3.MORE_WHITESPACE," "); -_12=_12.replace(_3.FINAL_SEMICOLONS,"}"); -return _12; -}; -var _13={mediaQueryList:function(s){ -var o={}; -var idx=s.indexOf("{"); -var lt=s.substring(0,idx); -s=s.substring(idx+1,s.length-1); -var mqs=[],rs=[]; -var qts=lt.toLowerCase().substring(7).split(","); -for(var i=0;i-1&&_23.href&&_23.href.length!==0&&!_23.disabled){ -_1f[_1f.length]=_23; -} -} -if(_1f.length>0){ -var c=0; -var _24=function(){ -c++; -if(c===_1f.length){ -_20(); -} -}; -var _25=function(_26){ -var _27=_26.href; -_c(_27,function(_28){ -_28=_11(_28).replace(_3.RELATIVE_URLS,"url("+_27.substring(0,_27.lastIndexOf("/"))+"/$1)"); -_26.cssHelperText=_28; -_24(); -},_24); -}; -for(i=0;i<_1f.length;i++){ -_25(_1f[i]); -} -}else{ -_20(); -} -}; -var _29={mediaQueryLists:"array",rules:"array",selectors:"object",declarations:"array",properties:"object"}; -var _2a={mediaQueryLists:null,rules:null,selectors:null,declarations:null,properties:null}; -var _2b=function(_2c,v){ -if(_2a[_2c]!==null){ -if(_29[_2c]==="array"){ -return (_2a[_2c]=_2a[_2c].concat(v)); -}else{ -var c=_2a[_2c]; -for(var n in v){ -if(v.hasOwnProperty(n)){ -if(!c[n]){ -c[n]=v[n]; -}else{ -c[n]=c[n].concat(v[n]); -} -} -} -return c; -} -} -}; -var _2d=function(_2e){ -_2a[_2e]=(_29[_2e]==="array")?[]:{}; -for(var i=0;i<_4.length;i++){ -_2b(_2e,_4[i].cssHelperParsed[_2e]); -} -return _2a[_2e]; -}; -domReady(function(){ -var els=document.body.getElementsByTagName("*"); -for(var i=0;i=_44)||(max&&_46<_44)||(!min&&!max&&_46===_44)); -}else{ -return false; -} -}else{ -return _46>0; -} -}else{ -if("device-height"===_41.substring(l-13,l)){ -_47=screen.height; -if(_42!==null){ -if(_43==="length"){ -return ((min&&_47>=_44)||(max&&_47<_44)||(!min&&!max&&_47===_44)); -}else{ -return false; -} -}else{ -return _47>0; -} -}else{ -if("width"===_41.substring(l-5,l)){ -_46=document.documentElement.clientWidth||document.body.clientWidth; -if(_42!==null){ -if(_43==="length"){ -return ((min&&_46>=_44)||(max&&_46<_44)||(!min&&!max&&_46===_44)); -}else{ -return false; -} -}else{ -return _46>0; -} -}else{ -if("height"===_41.substring(l-6,l)){ -_47=document.documentElement.clientHeight||document.body.clientHeight; -if(_42!==null){ -if(_43==="length"){ -return ((min&&_47>=_44)||(max&&_47<_44)||(!min&&!max&&_47===_44)); -}else{ -return false; -} -}else{ -return _47>0; -} -}else{ -if("device-aspect-ratio"===_41.substring(l-19,l)){ -return _43==="aspect-ratio"&&screen.width*_44[1]===screen.height*_44[0]; -}else{ -if("color-index"===_41.substring(l-11,l)){ -var _48=Math.pow(2,screen.colorDepth); -if(_42!==null){ -if(_43==="absolute"){ -return ((min&&_48>=_44)||(max&&_48<_44)||(!min&&!max&&_48===_44)); -}else{ -return false; -} -}else{ -return _48>0; -} -}else{ -if("color"===_41.substring(l-5,l)){ -var _49=screen.colorDepth; -if(_42!==null){ -if(_43==="absolute"){ -return ((min&&_49>=_44)||(max&&_49<_44)||(!min&&!max&&_49===_44)); -}else{ -return false; -} -}else{ -return _49>0; -} -}else{ -if("resolution"===_41.substring(l-10,l)){ -var res; -if(_45==="dpcm"){ -res=_3d("1cm"); -}else{ -res=_3d("1in"); -} -if(_42!==null){ -if(_43==="resolution"){ -return ((min&&res>=_44)||(max&&res<_44)||(!min&&!max&&res===_44)); -}else{ -return false; -} -}else{ -return res>0; -} -}else{ -return false; -} -} -} -} -} -} -} -} -}; -var _4a=function(mq){ -var _4b=mq.getValid(); -var _4c=mq.getExpressions(); -var l=_4c.length; -if(l>0){ -for(var i=0;i0){ -s[c++]=","; -} -s[c++]=n; -} -} -if(s.length>0){ -_39[_39.length]=cssHelper.addStyle("@media "+s.join("")+"{"+mql.getCssText()+"}",false); -} -}; -var _4e=function(_4f){ -for(var i=0;i<_4f.length;i++){ -_4d(_4f[i]); -} -if(ua.ie){ -document.documentElement.style.display="block"; -setTimeout(function(){ -document.documentElement.style.display=""; -},0); -setTimeout(function(){ -cssHelper.broadcast("cssMediaQueriesTested"); -},100); -}else{ -cssHelper.broadcast("cssMediaQueriesTested"); -} -}; -var _50=function(){ -for(var i=0;i<_39.length;i++){ -cssHelper.removeStyle(_39[i]); -} -_39=[]; -cssHelper.mediaQueryLists(_4e); -}; -var _51=0; -var _52=function(){ -var _53=cssHelper.getViewportWidth(); -var _54=cssHelper.getViewportHeight(); -if(ua.ie){ -var el=document.createElement("div"); -el.style.position="absolute"; -el.style.top="-9999em"; -el.style.overflow="scroll"; -document.body.appendChild(el); -_51=el.offsetWidth-el.clientWidth; -document.body.removeChild(el); -} -var _55; -var _56=function(){ -var vpw=cssHelper.getViewportWidth(); -var vph=cssHelper.getViewportHeight(); -if(Math.abs(vpw-_53)>_51||Math.abs(vph-_54)>_51){ -_53=vpw; -_54=vph; -clearTimeout(_55); -_55=setTimeout(function(){ -if(!_3a()){ -_50(); -}else{ -cssHelper.broadcast("cssMediaQueriesTested"); -} -},500); -} -}; -window.onresize=function(){ -var x=window.onresize||function(){ -}; -return function(){ -x(); -_56(); -}; -}(); -}; -var _57=document.documentElement; -_57.style.marginLeft="-32767px"; -setTimeout(function(){ -_57.style.marginTop=""; -},20000); -return function(){ -if(!_3a()){ -cssHelper.addListener("newStyleParsed",function(el){ -_4e(el.cssHelperParsed.mediaQueryLists); -}); -cssHelper.addListener("cssMediaQueriesTested",function(){ -if(ua.ie){ -_57.style.width="1px"; -} -setTimeout(function(){ -_57.style.width=""; -_57.style.marginLeft=""; -},0); -cssHelper.removeListener("cssMediaQueriesTested",arguments.callee); -}); -_3c(); -_50(); -}else{ -_57.style.marginLeft=""; -} -_52(); -}; -}()); -try{ -document.execCommand("BackgroundImageCache",false,true); -} -catch(e){ -} - diff --git a/kern_log_rainbow.png b/kern_log_rainbow.png deleted file mode 100644 index 4f03c8d..0000000 Binary files a/kern_log_rainbow.png and /dev/null differ diff --git a/kern_log_yb.png b/kern_log_yb.png deleted file mode 100644 index 64128fa..0000000 Binary files a/kern_log_yb.png and /dev/null differ diff --git a/ll_perms_groups_4_colors.png b/ll_perms_groups_4_colors.png deleted file mode 100644 index 8ad2f4e..0000000 Binary files a/ll_perms_groups_4_colors.png and /dev/null differ diff --git a/make_Cpp_vim.png b/make_Cpp_vim.png deleted file mode 100644 index 92f1a17..0000000 Binary files a/make_Cpp_vim.png and /dev/null differ diff --git a/params.json b/params.json deleted file mode 100644 index ddd707c..0000000 --- a/params.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Colout","tagline":"Color Up Arbitrary Command Output","body":"\r\n# colout\r\n\r\n## Introduction\r\n\r\ncolout is a simple command to add colors to a text stream in your terminal.\r\n\r\nThe `colout` command line interface has been carefully designed to be simple. Basically, you will call it like: ` | colout [color [style]]`.\r\n\r\ncolout has the ability to use 8 colors mode, 256 colors mode, colormaps, themes and source code syntax coloring.\r\nPatterns are regular expressions.\r\n\r\nYou can think of colout as an alternative to `grep --color` which will preserve the surrounding context, whith more\r\npowerful coloring capabilites.\r\n\r\n\r\n## Useful examples\r\n\r\n### Basic coloring\r\n\r\nIn the most simple use, you just have to call `colout word` to highlight what you want to spot in a text stream. This is\r\nparticularly useful when examining logs.\r\n\r\nColor every occurence of the word \"fail\" in bold red, in the boot log:\r\n`tail /var/log/boot.log | colout fail`\r\n\r\n![](boot_log_fail_red_bold.png)\r\n\r\nUsing regular expressions, you can highlight anything you want in a text stream.\r\n\r\nColor every _line_ containing the word \"fail\" in bold red, in the boot log:\r\n`tail /var/log/boot.log | colout \"^.*fail.*$\" red bold`\r\n\r\n![](boot_log_fail_line_red_bold.png)\r\n\r\nColor in blue the user name of the `ps` output that have been greped:\r\n`ps aux | grep firefox | colout \"^\\w+\\s\" blue`\r\n\r\n![](ps_grep_firefox_user_blue.png)\r\n\r\n\r\n### Multiple colors\r\n\r\nUsing groups in the regular expressions, you can highlight several matchs in different colors.\r\n\r\nHighlight the different parts of the permissions of files in your home directories, that are `rwx` for user and group,\r\nbut `r-x` for others:\r\n`ls -l ~ | colout \"^(d*)-*(rwx)(rwx)(r-x)\" blue,red,yellow,green`\r\n\r\n![](ll_perms_groups_4_colors.png)\r\n\r\nUsing colormaps, you can change the colors for each lines, this is particularly useful for reading logs that have long\r\nlines that are wrapped.\r\n`tail /var/log/kern.log | colout \"^.*$\" rainbow`\r\n\r\n![](kern_log_rainbow.png)\r\n\r\nIf you want more colors, you can highlight each line of your log with a random one among the 256 ANSI colors:\r\n`tail /var/log/dmesg | colout \"^.*$\" Random`\r\n\r\n![](dmesg_Random.png)\r\n\r\nYou can even fill your screen with esoteric disco characters (not _that_ useful, but fun):\r\n`cat /dev/urandom | colout \".\" Random`\r\n\r\n![](urandom_character.png)\r\n\r\n\r\n### Source code\r\n\r\nYou can use colout as a basic proxy to the pygments library, if you want to highlight a source code.\r\n\r\nFor example, let say you want to have a quick look at a source file, without being bothered by comments and empty lines:\r\n`tail colout.py | grep -v \"#\" | grep -v \"^\\s*$\" | colout -s Python monokai`\r\n\r\n![](code_grep_monokai.png)\r\n\r\nBut even more interesting, you can highlight the syntax of the matching parts of your text stream, which is useful\r\nfor spotting code in a log.\r\n\r\nFor example, color the code parts in the output of `g++` (they come inside single quotes):\r\n`make 2>&1 | colout \"'.*'\" Cpp vim`\r\n\r\n![](make_Cpp_vim.png)\r\n\r\n\r\n### Themes\r\n\r\ncolout comes with a set of handy shortcuts for coloring common outputs.\r\n\r\nFor example, if you often build your software with `cmake` but find its coloring scheme a bit boring, you can use the\r\nfollowing shortcut:\r\n`make 2>&1 | colout -t cmake`\r\n\r\n![](cmake_theme_paradiseo.png)\r\n\r\nYou can, of course, combine several calls to colout using pipes:\r\n`make 2>&1 | colout -t cmake | colout -t g++`\r\n\r\n![](themes_cmake_g++_paradiseo.png)\r\n\r\n\r\n## Tips\r\n\r\nTo be able to use the syntax highlighting, you should install the `python-pygments` library.\r\n\r\n`colout -h` will give you the lists of available colors, themes and programming languages.\r\n\r\nColormaps and source code syntax highlighting most often comes in 8 or 256 colors mode. Use a lower case first letter\r\nfor the 8 colors mode and an upper case first one for the 256 colors.\r\n\r\nThe 8 colors mode syntax highlighting only comes in two styles: light and dark. If you want more fancy styles, you\r\nshould use 256 colors mode, and thus upper case the first letter of the language name, or else the style is ignored.\r\n\r\nYou can leave simple words without quotes, but it is better to put the regexp in quotes to avoid escaping special\r\ncharacters that would overwise be interpreted\r\nby your shell (like parenthesis).\r\n\r\nDo not hesitate to design your own theme, they are defined as separated files, and basically are just like chaining\r\nseveral calls to colout in pipes, with the possibility to use python code around.\r\n\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file diff --git a/progress_Rainbow.png b/progress_Rainbow.png deleted file mode 100644 index 5626044..0000000 Binary files a/progress_Rainbow.png and /dev/null differ diff --git a/ps_grep_firefox_user_blue.png b/ps_grep_firefox_user_blue.png deleted file mode 100644 index 1506342..0000000 Binary files a/ps_grep_firefox_user_blue.png and /dev/null differ diff --git a/requirements-build.txt b/requirements-build.txt new file mode 100644 index 0000000..d50412d --- /dev/null +++ b/requirements-build.txt @@ -0,0 +1,3 @@ +tox +tox-wheel +twine diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6bf5211 --- /dev/null +++ b/setup.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +import os +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +if sys.argv[-1] == 'publish': + os.system('python setup.py bdist_wheel --universal upload') + sys.exit() + +packages = ['colout'] + +requires = ['pygments', 'babel'] + +setup_requires = ['setuptools_scm'] + +classifiers = """ +Environment :: Console +Development Status :: 5 - Production/Stable +License :: OSI Approved :: GNU General Public License v3 (GPLv3) +Operating System :: POSIX +Operating System :: POSIX :: Linux +Programming Language :: Python :: 3 +Programming Language :: Python :: 3.5 +Programming Language :: Python :: 3.6 +Programming Language :: Python :: 3.7 +Programming Language :: Python :: 3.8 +Topic :: Utilities +Topic :: Text Processing +Topic :: Text Processing :: Filters +""".strip().split('\n') + +setup( + name='colout', + use_scm_version=True, + classifiers=classifiers, + description='Color Up Arbitrary Command Output.', + entry_points={ + 'console_scripts': ['colout=colout.colout:main'], + }, + long_description=open(os.path.join(os.path.dirname(__file__), 'README.md')).read(), + long_description_content_type='text/markdown;variant=CommonMark', + author='nojhan', + author_email='nojhan@nojhan.net', + url='http://nojhan.github.com/colout/', + packages=packages, + package_data={'': ['LICENSE', 'README.md']}, + package_dir={'colout': 'colout'}, + python_requires='>=3.5', + setup_requires=setup_requires, + include_package_data=True, + install_requires=requires, + license='GPLv3', + zip_safe=False, +) diff --git a/stylesheets/ie.css b/stylesheets/ie.css deleted file mode 100644 index 43882f2..0000000 --- a/stylesheets/ie.css +++ /dev/null @@ -1,3 +0,0 @@ -nav { - display: none; -} diff --git a/stylesheets/normalize.css b/stylesheets/normalize.css deleted file mode 100644 index bc2ba93..0000000 --- a/stylesheets/normalize.css +++ /dev/null @@ -1,459 +0,0 @@ -/* normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */ -/* ============================================================================= - HTML5 display definitions - ========================================================================== */ -/* - * Corrects block display not defined in IE6/7/8/9 & FF3 - */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -nav, -section, -summary { - display: block; -} - -/* - * Corrects inline-block display not defined in IE6/7/8/9 & FF3 - */ -audio, -canvas, -video { - display: inline-block; - *display: inline; - *zoom: 1; -} - -/* - * Prevents modern browsers from displaying 'audio' without controls - */ -audio:not([controls]) { - display: none; -} - -/* - * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4 - * Known issue: no IE6 support - */ -[hidden] { - display: none; -} - -/* ============================================================================= - Base - ========================================================================== */ -/* - * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units - * http://clagnut.com/blog/348/#c790 - * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom - * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ - */ -html { - font-size: 100%; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -ms-text-size-adjust: 100%; - /* 2 */ -} - -/* - * Addresses font-family inconsistency between 'textarea' and other form elements. - */ -html, -button, -input, -select, -textarea { - font-family: sans-serif; -} - -/* - * Addresses margins handled incorrectly in IE6/7 - */ -body { - margin: 0; -} - -/* ============================================================================= - Links - ========================================================================== */ -/* - * Addresses outline displayed oddly in Chrome - */ -a:focus { - outline: thin dotted; -} - -/* - * Improves readability when focused and also mouse hovered in all browsers - * people.opera.com/patrickl/experiments/keyboard/test - */ -a:hover, -a:active { - outline: 0; -} - -/* ============================================================================= - Typography - ========================================================================== */ -/* - * Addresses font sizes and margins set differently in IE6/7 - * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5 - */ -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -h2 { - font-size: 1.5em; - margin: 0.83em 0; -} - -h3 { - font-size: 1.17em; - margin: 1em 0; -} - -h4 { - font-size: 1em; - margin: 1.33em 0; -} - -h5 { - font-size: 0.83em; - margin: 1.67em 0; -} - -h6 { - font-size: 0.75em; - margin: 2.33em 0; -} - -/* - * Addresses styling not present in IE7/8/9, S5, Chrome - */ -abbr[title] { - border-bottom: 1px dotted; -} - -/* - * Addresses style set to 'bolder' in FF3+, S4/5, Chrome -*/ -b, -strong { - font-weight: bold; -} - -blockquote { - margin: 1em 40px; -} - -/* - * Addresses styling not present in S5, Chrome - */ -dfn { - font-style: italic; -} - -/* - * Addresses styling not present in IE6/7/8/9 - */ -mark { - background: #ff0; - color: #000; -} - -/* - * Addresses margins set differently in IE6/7 - */ -p, -pre { - margin: 1em 0; -} - -/* - * Corrects font family set oddly in IE6, S4/5, Chrome - * en.wikipedia.org/wiki/User:Davidgothberg/Test59 - */ -pre, -code, -kbd, -samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; -} - -/* - * 1. Addresses CSS quotes not supported in IE6/7 - * 2. Addresses quote property not supported in S4 - */ -/* 1 */ -q { - quotes: none; -} - -/* 2 */ -q:before, -q:after { - content: ''; - content: none; -} - -small { - font-size: 75%; -} - -/* - * Prevents sub and sup affecting line-height in all browsers - * gist.github.com/413930 - */ -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* ============================================================================= - Lists - ========================================================================== */ -/* - * Addresses margins set differently in IE6/7 - */ -dl, -menu, -ol, -ul { - margin: 1em 0; -} - -dd { - margin: 0 0 0 40px; -} - -/* - * Addresses paddings set differently in IE6/7 - */ -menu, -ol, -ul { - padding: 0 0 0 40px; -} - -/* - * Corrects list images handled incorrectly in IE7 - */ -nav ul, -nav ol { - list-style: none; - list-style-image: none; -} - -/* ============================================================================= - Embedded content - ========================================================================== */ -/* - * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3 - * 2. Improves image quality when scaled in IE7 - * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ - */ -img { - border: 0; - /* 1 */ - -ms-interpolation-mode: bicubic; - /* 2 */ -} - -/* - * Corrects overflow displayed oddly in IE9 - */ -svg:not(:root) { - overflow: hidden; -} - -/* ============================================================================= - Figures - ========================================================================== */ -/* - * Addresses margin not present in IE6/7/8/9, S5, O11 - */ -figure { - margin: 0; -} - -/* ============================================================================= - Forms - ========================================================================== */ -/* - * Corrects margin displayed oddly in IE6/7 - */ -form { - margin: 0; -} - -/* - * Define consistent border, margin, and padding - */ -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/* - * 1. Corrects color not being inherited in IE6/7/8/9 - * 2. Corrects text not wrapping in FF3 - * 3. Corrects alignment displayed oddly in IE6/7 - */ -legend { - border: 0; - /* 1 */ - padding: 0; - white-space: normal; - /* 2 */ - *margin-left: -7px; - /* 3 */ -} - -/* - * 1. Corrects font size not being inherited in all browsers - * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome - * 3. Improves appearance and consistency in all browsers - */ -button, -input, -select, -textarea { - font-size: 100%; - /* 1 */ - margin: 0; - /* 2 */ - vertical-align: baseline; - /* 3 */ - *vertical-align: middle; - /* 3 */ -} - -/* - * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet - */ -button, -input { - line-height: normal; - /* 1 */ -} - -/* - * 1. Improves usability and consistency of cursor style between image-type 'input' and others - * 2. Corrects inability to style clickable 'input' types in iOS - * 3. Removes inner spacing in IE7 without affecting normal text inputs - * Known issue: inner spacing remains in IE6 - */ -button, -input[type="button"], -input[type="reset"], -input[type="submit"] { - cursor: pointer; - /* 1 */ - -webkit-appearance: button; - /* 2 */ - *overflow: visible; - /* 3 */ -} - -/* - * Re-set default cursor for disabled elements - */ -button[disabled], -input[disabled] { - cursor: default; -} - -/* - * 1. Addresses box sizing set to content-box in IE8/9 - * 2. Removes excess padding in IE8/9 - * 3. Removes excess padding in IE7 - Known issue: excess padding remains in IE6 - */ -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; - /* 1 */ - padding: 0; - /* 2 */ - *height: 13px; - /* 3 */ - *width: 13px; - /* 3 */ -} - -/* - * 1. Addresses appearance set to searchfield in S5, Chrome - * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof) - */ -input[type="search"] { - -webkit-appearance: textfield; - /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - /* 2 */ - box-sizing: content-box; -} - -/* - * Removes inner padding and search cancel button in S5, Chrome on OS X - */ -input[type="search"]::-webkit-search-decoration, -input[type="search"]::-webkit-search-cancel-button { - -webkit-appearance: none; -} - -/* - * Removes inner padding and border in FF3+ - * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ - */ -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/* - * 1. Removes default vertical scrollbar in IE6/7/8/9 - * 2. Improves readability and alignment in all browsers - */ -textarea { - overflow: auto; - /* 1 */ - vertical-align: top; - /* 2 */ -} - -/* ============================================================================= - Tables - ========================================================================== */ -/* - * Remove most spacing between table cells - */ -table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/stylesheets/pygment_trac.css b/stylesheets/pygment_trac.css deleted file mode 100644 index c79bef4..0000000 --- a/stylesheets/pygment_trac.css +++ /dev/null @@ -1,70 +0,0 @@ -.highlight .hll { background-color: #404040 } -.highlight { color: #d0d0d0 } -.highlight .c { color: #999999; font-style: italic } /* Comment */ -.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ -.highlight .g { color: #d0d0d0 } /* Generic */ -.highlight .k { color: #6ab825; font-weight: normal } /* Keyword */ -.highlight .l { color: #d0d0d0 } /* Literal */ -.highlight .n { color: #d0d0d0 } /* Name */ -.highlight .o { color: #d0d0d0 } /* Operator */ -.highlight .x { color: #d0d0d0 } /* Other */ -.highlight .p { color: #d0d0d0 } /* Punctuation */ -.highlight .cm { color: #999999; font-style: italic } /* Comment.Multiline */ -.highlight .cp { color: #cd2828; font-weight: normal } /* Comment.Preproc */ -.highlight .c1 { color: #999999; font-style: italic } /* Comment.Single */ -.highlight .cs { color: #e50808; font-weight: normal; background-color: #520000 } /* Comment.Special */ -.highlight .gd { color: #d22323 } /* Generic.Deleted */ -.highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */ -.highlight .gr { color: #d22323 } /* Generic.Error */ -.highlight .gh { color: #ffffff; font-weight: normal } /* Generic.Heading */ -.highlight .gi { color: #589819 } /* Generic.Inserted */ -.highlight .go { color: #cccccc } /* Generic.Output */ -.highlight .gp { color: #aaaaaa } /* Generic.Prompt */ -.highlight .gs { color: #d0d0d0; font-weight: normal } /* Generic.Strong */ -.highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */ -.highlight .gt { color: #d22323 } /* Generic.Traceback */ -.highlight .kc { color: #6ab825; font-weight: normal } /* Keyword.Constant */ -.highlight .kd { color: #6ab825; font-weight: normal } /* Keyword.Declaration */ -.highlight .kn { color: #6ab825; font-weight: normal } /* Keyword.Namespace */ -.highlight .kp { color: #6ab825 } /* Keyword.Pseudo */ -.highlight .kr { color: #6ab825; font-weight: normal } /* Keyword.Reserved */ -.highlight .kt { color: #6ab825; font-weight: normal } /* Keyword.Type */ -.highlight .ld { color: #d0d0d0 } /* Literal.Date */ -.highlight .m { color: #3677a9 } /* Literal.Number */ -.highlight .s { color: #9dd5f1 } /* Literal.String */ -.highlight .na { color: #bbbbbb } /* Name.Attribute */ -.highlight .nb { color: #24909d } /* Name.Builtin */ -.highlight .nc { color: #447fcf; text-decoration: underline } /* Name.Class */ -.highlight .no { color: #40ffff } /* Name.Constant */ -.highlight .nd { color: #ffa500 } /* Name.Decorator */ -.highlight .ni { color: #d0d0d0 } /* Name.Entity */ -.highlight .ne { color: #bbbbbb } /* Name.Exception */ -.highlight .nf { color: #447fcf } /* Name.Function */ -.highlight .nl { color: #d0d0d0 } /* Name.Label */ -.highlight .nn { color: #447fcf; text-decoration: underline } /* Name.Namespace */ -.highlight .nx { color: #d0d0d0 } /* Name.Other */ -.highlight .py { color: #d0d0d0 } /* Name.Property */ -.highlight .nt { color: #6ab825;} /* Name.Tag */ -.highlight .nv { color: #40ffff } /* Name.Variable */ -.highlight .ow { color: #6ab825; font-weight: normal } /* Operator.Word */ -.highlight .w { color: #666666 } /* Text.Whitespace */ -.highlight .mf { color: #3677a9 } /* Literal.Number.Float */ -.highlight .mh { color: #3677a9 } /* Literal.Number.Hex */ -.highlight .mi { color: #3677a9 } /* Literal.Number.Integer */ -.highlight .mo { color: #3677a9 } /* Literal.Number.Oct */ -.highlight .sb { color: #9dd5f1 } /* Literal.String.Backtick */ -.highlight .sc { color: #9dd5f1 } /* Literal.String.Char */ -.highlight .sd { color: #9dd5f1 } /* Literal.String.Doc */ -.highlight .s2 { color: #9dd5f1 } /* Literal.String.Double */ -.highlight .se { color: #9dd5f1 } /* Literal.String.Escape */ -.highlight .sh { color: #9dd5f1 } /* Literal.String.Heredoc */ -.highlight .si { color: #9dd5f1 } /* Literal.String.Interpol */ -.highlight .sx { color: #ffa500 } /* Literal.String.Other */ -.highlight .sr { color: #9dd5f1 } /* Literal.String.Regex */ -.highlight .s1 { color: #9dd5f1 } /* Literal.String.Single */ -.highlight .ss { color: #9dd5f1 } /* Literal.String.Symbol */ -.highlight .bp { color: #24909d } /* Name.Builtin.Pseudo */ -.highlight .vc { color: #40ffff } /* Name.Variable.Class */ -.highlight .vg { color: #40ffff } /* Name.Variable.Global */ -.highlight .vi { color: #40ffff } /* Name.Variable.Instance */ -.highlight .il { color: #3677a9 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/stylesheets/styles.css b/stylesheets/styles.css deleted file mode 100644 index e7b4ffc..0000000 --- a/stylesheets/styles.css +++ /dev/null @@ -1,851 +0,0 @@ -@font-face { - font-family: 'OpenSansLight'; - src: url("../fonts/OpenSans-Light-webfont.eot"); - src: url("../fonts/OpenSans-Light-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Light-webfont.woff") format("woff"), url("../fonts/OpenSans-Light-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Light-webfont.svg#OpenSansLight") format("svg"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'OpenSansLightItalic'; - src: url("../fonts/OpenSans-LightItalic-webfont.eot"); - src: url("../fonts/OpenSans-LightItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-LightItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-LightItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic") format("svg"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'OpenSansRegular'; - src: url("../fonts/OpenSans-Regular-webfont.eot"); - src: url("../fonts/OpenSans-Regular-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Regular-webfont.woff") format("woff"), url("../fonts/OpenSans-Regular-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Regular-webfont.svg#OpenSansRegular") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -@font-face { - font-family: 'OpenSansItalic'; - src: url("../fonts/OpenSans-Italic-webfont.eot"); - src: url("../fonts/OpenSans-Italic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Italic-webfont.woff") format("woff"), url("../fonts/OpenSans-Italic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Italic-webfont.svg#OpenSansItalic") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -@font-face { - font-family: 'OpenSansSemibold'; - src: url("../fonts/OpenSans-Semibold-webfont.eot"); - src: url("../fonts/OpenSans-Semibold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Semibold-webfont.woff") format("woff"), url("../fonts/OpenSans-Semibold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -@font-face { - font-family: 'OpenSansSemiboldItalic'; - src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot"); - src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-SemiboldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-SemiboldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -@font-face { - font-family: 'OpenSansBold'; - src: url("../fonts/OpenSans-Bold-webfont.eot"); - src: url("../fonts/OpenSans-Bold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Bold-webfont.woff") format("woff"), url("../fonts/OpenSans-Bold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Bold-webfont.svg#OpenSansBold") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -@font-face { - font-family: 'OpenSansBoldItalic'; - src: url("../fonts/OpenSans-BoldItalic-webfont.eot"); - src: url("../fonts/OpenSans-BoldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-BoldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-BoldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic") format("svg"); - font-weight: normal; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -/* normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */ -/* ============================================================================= - HTML5 display definitions - ========================================================================== */ -/* - * Corrects block display not defined in IE6/7/8/9 & FF3 - */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -nav, -section, -summary { - display: block; -} - -/* - * Corrects inline-block display not defined in IE6/7/8/9 & FF3 - */ -audio, -canvas, -video { - display: inline-block; - *display: inline; - *zoom: 1; -} - -/* - * Prevents modern browsers from displaying 'audio' without controls - */ -audio:not([controls]) { - display: none; -} - -/* - * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4 - * Known issue: no IE6 support - */ -[hidden] { - display: none; -} - -/* ============================================================================= - Base - ========================================================================== */ -/* - * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units - * http://clagnut.com/blog/348/#c790 - * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom - * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ - */ -html { - font-size: 100%; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -ms-text-size-adjust: 100%; - /* 2 */ -} - -/* - * Addresses font-family inconsistency between 'textarea' and other form elements. - */ -html, -button, -input, -select, -textarea { - font-family: sans-serif; -} - -/* - * Addresses margins handled incorrectly in IE6/7 - */ -body { - margin: 0; -} - -/* ============================================================================= - Links - ========================================================================== */ -/* - * Addresses outline displayed oddly in Chrome - */ -a:focus { - outline: thin dotted; -} - -/* - * Improves readability when focused and also mouse hovered in all browsers - * people.opera.com/patrickl/experiments/keyboard/test - */ -a:hover, -a:active { - outline: 0; -} - -/* ============================================================================= - Typography - ========================================================================== */ -/* - * Addresses font sizes and margins set differently in IE6/7 - * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5 - */ -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -h2 { - font-size: 1.5em; - margin: 0.83em 0; -} - -h3 { - font-size: 1.17em; - margin: 1em 0; -} - -h4 { - font-size: 1em; - margin: 1.33em 0; -} - -h5 { - font-size: 0.83em; - margin: 1.67em 0; -} - -h6 { - font-size: 0.75em; - margin: 2.33em 0; -} - -/* - * Addresses styling not present in IE7/8/9, S5, Chrome - */ -abbr[title] { - border-bottom: 1px dotted; -} - -/* - * Addresses style set to 'bolder' in FF3+, S4/5, Chrome -*/ -b, -strong { - font-weight: bold; -} - -blockquote { - margin: 1em 40px; -} - -/* - * Addresses styling not present in S5, Chrome - */ -dfn { - font-style: italic; -} - -/* - * Addresses styling not present in IE6/7/8/9 - */ -mark { - background: #ff0; - color: #000; -} - -/* - * Addresses margins set differently in IE6/7 - */ -p, -pre { - margin: 1em 0; -} - -/* - * Corrects font family set oddly in IE6, S4/5, Chrome - * en.wikipedia.org/wiki/User:Davidgothberg/Test59 - */ -pre, -code, -kbd, -samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; -} - -/* - * 1. Addresses CSS quotes not supported in IE6/7 - * 2. Addresses quote property not supported in S4 - */ -/* 1 */ -q { - quotes: none; -} - -/* 2 */ -q:before, -q:after { - content: ''; - content: none; -} - -small { - font-size: 75%; -} - -/* - * Prevents sub and sup affecting line-height in all browsers - * gist.github.com/413930 - */ -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* ============================================================================= - Lists - ========================================================================== */ -/* - * Addresses margins set differently in IE6/7 - */ -dl, -menu, -ol, -ul { - margin: 1em 0; -} - -dd { - margin: 0 0 0 40px; -} - -/* - * Addresses paddings set differently in IE6/7 - */ -menu, -ol, -ul { - padding: 0 0 0 40px; -} - -/* - * Corrects list images handled incorrectly in IE7 - */ -nav ul, -nav ol { - list-style: none; - list-style-image: none; -} - -/* ============================================================================= - Embedded content - ========================================================================== */ -/* - * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3 - * 2. Improves image quality when scaled in IE7 - * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ - */ -img { - border: 0; - /* 1 */ - -ms-interpolation-mode: bicubic; - /* 2 */ -} - -/* - * Corrects overflow displayed oddly in IE9 - */ -svg:not(:root) { - overflow: hidden; -} - -/* ============================================================================= - Figures - ========================================================================== */ -/* - * Addresses margin not present in IE6/7/8/9, S5, O11 - */ -figure { - margin: 0; -} - -/* ============================================================================= - Forms - ========================================================================== */ -/* - * Corrects margin displayed oddly in IE6/7 - */ -form { - margin: 0; -} - -/* - * Define consistent border, margin, and padding - */ -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/* - * 1. Corrects color not being inherited in IE6/7/8/9 - * 2. Corrects text not wrapping in FF3 - * 3. Corrects alignment displayed oddly in IE6/7 - */ -legend { - border: 0; - /* 1 */ - padding: 0; - white-space: normal; - /* 2 */ - *margin-left: -7px; - /* 3 */ -} - -/* - * 1. Corrects font size not being inherited in all browsers - * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome - * 3. Improves appearance and consistency in all browsers - */ -button, -input, -select, -textarea { - font-size: 100%; - /* 1 */ - margin: 0; - /* 2 */ - vertical-align: baseline; - /* 3 */ - *vertical-align: middle; - /* 3 */ -} - -/* - * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet - */ -button, -input { - line-height: normal; - /* 1 */ -} - -/* - * 1. Improves usability and consistency of cursor style between image-type 'input' and others - * 2. Corrects inability to style clickable 'input' types in iOS - * 3. Removes inner spacing in IE7 without affecting normal text inputs - * Known issue: inner spacing remains in IE6 - */ -button, -input[type="button"], -input[type="reset"], -input[type="submit"] { - cursor: pointer; - /* 1 */ - -webkit-appearance: button; - /* 2 */ - *overflow: visible; - /* 3 */ -} - -/* - * Re-set default cursor for disabled elements - */ -button[disabled], -input[disabled] { - cursor: default; -} - -/* - * 1. Addresses box sizing set to content-box in IE8/9 - * 2. Removes excess padding in IE8/9 - * 3. Removes excess padding in IE7 - Known issue: excess padding remains in IE6 - */ -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; - /* 1 */ - padding: 0; - /* 2 */ - *height: 13px; - /* 3 */ - *width: 13px; - /* 3 */ -} - -/* - * 1. Addresses appearance set to searchfield in S5, Chrome - * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof) - */ -input[type="search"] { - -webkit-appearance: textfield; - /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - /* 2 */ - box-sizing: content-box; -} - -/* - * Removes inner padding and search cancel button in S5, Chrome on OS X - */ -input[type="search"]::-webkit-search-decoration, -input[type="search"]::-webkit-search-cancel-button { - -webkit-appearance: none; -} - -/* - * Removes inner padding and border in FF3+ - * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ - */ -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/* - * 1. Removes default vertical scrollbar in IE6/7/8/9 - * 2. Improves readability and alignment in all browsers - */ -textarea { - overflow: auto; - /* 1 */ - vertical-align: top; - /* 2 */ -} - -/* ============================================================================= - Tables - ========================================================================== */ -/* - * Remove most spacing between table cells - */ -table { - border-collapse: collapse; - border-spacing: 0; -} - -body { - padding: 0px 0 20px 0px; - margin: 0px; - font: 14px/1.5 "OpenSansRegular", "Helvetica Neue", Helvetica, Arial, sans-serif; - color: #f0e7d5; - font-weight: normal; - background: #252525; - background-attachment: fixed !important; - background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #2a2a29), color-stop(100%, #1c1c1c)); - background: -webkit-linear-gradient(#2a2a29, #1c1c1c); - background: -moz-linear-gradient(#2a2a29, #1c1c1c); - background: -o-linear-gradient(#2a2a29, #1c1c1c); - background: -ms-linear-gradient(#2a2a29, #1c1c1c); - background: linear-gradient(#2a2a29, #1c1c1c); -} - -h1, h2, h3, h4, h5, h6 { - color: #e8e8e8; - margin: 0 0 10px; - font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: normal; -} - -p, ul, ol, table, pre, dl { - margin: 0 0 20px; -} - -h1, h2, h3 { - line-height: 1.1; -} - -h1 { - font-size: 28px; -} - -h2 { - font-size: 24px; -} - -h4, h5, h6 { - color: #e8e8e8; -} - -h3 { - font-size: 18px; - line-height: 24px; - font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif !important; - font-weight: normal; - color: #b6b6b6; -} - -a { - color: #ffcc00; - font-weight: 400; - text-decoration: none; -} -a:hover { - color: #ffeb9b; -} - -a small { - font-size: 11px; - color: #666; - margin-top: -0.6em; - display: block; -} - -ul { - list-style-image: url("../images/bullet.png"); -} - -strong { - font-family: 'OpenSansBold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; - font-weight: normal; -} - -.wrapper { - max-width: 650px; - margin: 0 auto; - position: relative; - padding: 0 20px; -} - -section img { - max-width: 100%; -} - -blockquote { - border-left: 3px solid #ffcc00; - margin: 0; - padding: 0 0 0 20px; - font-style: italic; -} - -code { - font-family: "Lucida Sans", Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; - color: #efefef; - font-size: 13px; - margin: 0 4px; - padding: 4px 6px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -o-border-radius: 2px; - -ms-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; -} - -pre { - padding: 8px 15px; - background: #191919; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -o-border-radius: 2px; - -ms-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; - border: 1px solid #121212; - -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); - -o-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); - box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); - overflow: auto; - overflow-y: hidden; -} -pre code { - color: #efefef; - text-shadow: 0px 1px 0px #000; - margin: 0; - padding: 0; -} - -table { - width: 100%; - border-collapse: collapse; -} - -th { - text-align: left; - padding: 5px 10px; - border-bottom: 1px solid #434343; - color: #b6b6b6; - font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; - font-weight: normal; -} - -td { - text-align: left; - padding: 5px 10px; - border-bottom: 1px solid #434343; -} - -hr { - border: 0; - outline: none; - height: 3px; - background: transparent url("../images/hr.gif") center center repeat-x; - margin: 0 0 20px; -} - -dt { - color: #F0E7D5; - font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; - font-weight: normal; -} - -#header { - z-index: 100; - left: 0; - top: 0px; - height: 60px; - width: 100%; - position: fixed; - background: url(../images/nav-bg.gif) #353535; - border-bottom: 4px solid #434343; - -moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); - -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); - -o-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); - box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); -} -#header nav { - max-width: 650px; - margin: 0 auto; - padding: 0 10px; - background: blue; - margin: 6px auto; -} -#header nav li { - font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: normal; - list-style: none; - display: inline; - color: white; - line-height: 50px; - text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.2); - font-size: 14px; -} -#header nav li a { - color: white; - border: 1px solid #5d910b; - background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #93bd20), color-stop(100%, #659e10)); - background: -webkit-linear-gradient(#93bd20, #659e10); - background: -moz-linear-gradient(#93bd20, #659e10); - background: -o-linear-gradient(#93bd20, #659e10); - background: -ms-linear-gradient(#93bd20, #659e10); - background: linear-gradient(#93bd20, #659e10); - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -o-border-radius: 2px; - -ms-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; - -moz-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); - -webkit-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); - -o-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); - box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); - background-color: #93bd20; - padding: 10px 12px; - margin-top: 6px; - line-height: 14px; - font-size: 14px; - display: inline-block; - text-align: center; -} -#header nav li a:hover { - background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #749619), color-stop(100%, #527f0e)); - background: -webkit-linear-gradient(#749619, #527f0e); - background: -moz-linear-gradient(#749619, #527f0e); - background: -o-linear-gradient(#749619, #527f0e); - background: -ms-linear-gradient(#749619, #527f0e); - background: linear-gradient(#749619, #527f0e); - background-color: #659e10; - border: 1px solid #527f0e; - -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); - -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); - -o-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); - box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); -} -#header nav li.fork { - float: left; - margin-left: 0px; -} -#header nav li.downloads { - float: right; - margin-left: 6px; -} -#header nav li.title { - float: right; - margin-right: 10px; - font-size: 11px; -} - -section { - max-width: 650px; - padding: 30px 0px 50px 0px; - margin: 20px 0; - margin-top: 70px; -} -section #title { - border: 0; - outline: none; - margin: 0 0 50px 0; - padding: 0 0 5px 0; -} -section #title h1 { - font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: normal; - font-size: 40px; - text-align: center; - line-height: 36px; -} -section #title p { - color: #d7cfbe; - font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: normal; - font-size: 18px; - text-align: center; -} -section #title .credits { - font-size: 11px; - font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: normal; - color: #696969; - margin-top: -10px; -} -section #title .credits.left { - float: left; -} -section #title .credits.right { - float: right; -} - -@media print, screen and (max-width: 720px) { - #title .credits { - display: block; - width: 100%; - line-height: 30px; - text-align: center; - } - #title .credits .left { - float: none; - display: block; - } - #title .credits .right { - float: none; - display: block; - } -} -@media print, screen and (max-width: 480px) { - #header { - margin-top: -20px; - } - - section { - margin-top: 40px; - } - - nav { - display: none; - } -} diff --git a/themes_cmake_g++_paradiseo.png b/themes_cmake_g++_paradiseo.png deleted file mode 100644 index 80d713c..0000000 Binary files a/themes_cmake_g++_paradiseo.png and /dev/null differ diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..ff4e1ca --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +envlist=py35,py36,py37,py38,cov + +[testenv] +wheel = true +deps= + pytest + pytest-cov + pytest-xdist +setenv= + py{35,36,37,38}: COVERAGE_FILE=.coverage.{envname} +commands= + py{35,36,37,38}: python -m pytest --cov=colout --cov-report=term-missing --no-cov-on-fail + cov: coverage combine + cov: coverage html --fail-under=85 diff --git a/urandom_character.png b/urandom_character.png deleted file mode 100644 index 0bedb48..0000000 Binary files a/urandom_character.png and /dev/null differ diff --git a/valgrind_colout.png b/valgrind_colout.png deleted file mode 100644 index 6f9fb1b..0000000 Binary files a/valgrind_colout.png and /dev/null differ