PrettyColors is a Swift library for styling and coloring text in the Terminal.

Related tags

Color PrettyColors
Overview

PrettyColors

Carthage Compatibility Swift Package Manager Compatibility CocoaPods Version License Platform

Description

PrettyColors is a Swift library for styling and coloring text in the Terminal. The library outputs ANSI escape codes and conforms to ECMA Standard 48.

Example

import PrettyColors

let redText: String = Color.Wrap(foreground: .red).wrap("A red piece of text.")
println(redText)

Color.Wrap(foreground: .yellow, style: .bold)
Color.Wrap(foreground: .green, background: .black, style: .bold, .underlined)

// 8-bit (256) color support
Color.Wrap(foreground: 114)
Color.Wrap(foreground: 114, style: .bold)

More examples can be found in the tests.

Installation

Carthage

Add the following to your Cartfile:

github "jdhealy/PrettyColors"

CocoaPods

Add the following to your Podfile:

pod 'PrettyColors', :git => 'https://github.com/jdhealy/PrettyColors'

You will also need to make sure you're opting into using frameworks:

use_frameworks!

Then run pod install with CocoaPods 0.36 or newer.

Inspiration

License

PrettyColors is released under the MIT license. See LICENSE.md for details.

Comments
  • Swift 2.3 · Reduce to single framework target and single scheme · Support tvOS and watchOS

    Swift 2.3 · Reduce to single framework target and single scheme · Support tvOS and watchOS

    Reduce to single framework target, configured with jdhealy/FABConfig.

    • Reduce to single test target, also configured with jdhealy/FABConfig.
    • Reduce to single scheme.
    • Support additional platforms of tvOS and watchOS and corresponding simulators.
    • Set CODE_SIGNING_REQUIRED to NO (through jdhealy/FABConfig).
      • Remove configuration CODE_SIGN_IDENTITY[sdk=iphoneos*] = "iPhone Developer".
      • Trust in Xcode 8+ automatic code signing defaults.
        • Code signing will usually still be required at the point of embedding PrettyColors in a code-signed bundle.
        • See https://github.com/jdhealy/FABConfig/pull/1 for more info.
    • Set SWIFT_VERSION to 2.3, solely to prevent Xcode from offering the Swift Migrator.
      • No source migration was necessary; compatibility with Swift 2.2 remains.
    opened by jdhealy 4
  • Update .travis.yml

    Update .travis.yml

    • Add Xcode 8.3 and Xcode 9 jobs
    • Remove redundant Xcode 8 and Xcode 8.1 jobs
    • Remove redundant Swift 3.0 and Swift 3.0.1 jobs on Linux
    • Explicit git submodule update --init --recursive is not needed anymore
    • Submodules are not needed for SwiftPM
    opened by ikesyo 3
  • Pod install error on Xcode 10.2

    Pod install error on Xcode 10.2

    Getting the following error when trying to do pod install on latest Xcode 10.2

    Installing PrettyColors 5.0.2
    
    [!] Invalid `PrettyColors.podspec` file: undefined method `swift_versions=' for #<Pod::Specification name="PrettyColors">
    Did you mean?  swift_version=
                   swift_version.
    
     #  from /var/folders/0f/pbyp18ds4psf0d6_37twvfbc0000gn/T/d20190327-39339-1gjgqm1/PrettyColors.podspec:13
     #  -------------------------------------------
     #    spec.source_files = 'Source/**/*.{h,swift}'
     >    spec.swift_versions = ['3.0', '4.0', '4.2', '5.0']
     #    spec.requires_arc = true
     #  -------------------------------------------
    
    opened by rahul0x24 2
  • SPM depends on a version tag without the

    SPM depends on a version tag without the "v"

    It seems that SPM needs a version tag that isn't prefixed with "v" in order to work.

    i.e. 4.0.0 not v4.0.0. Luckily there is nothing that prevents git from having both tags if you don't want to just switch. For the next release could you tag it this way?

    swift build
    Cloning https://github.com/jdhealy/PrettyColors.git
    error: The dependency graph could not be satisfied. The package (https://github.com/jdhealy/PrettyColors.git) with version tag in range (4.0.0..<4.9223372036854775807.9223372036854775807) is not found. Found tags ([0.0.1, 0.0.2])
    
    opened by gorzell 2
  • XcodeColors support

    XcodeColors support

    Thank you for useful library!

    ❓ Does PrettyColors outputs strings that are colored in Xcode console output?

    I've tried using XcodeColors, which works well with manually inserted color codes. https://github.com/robbiehanson/XcodeColors but could not seem get it to recognize PrettyColors strings.

    Escape code in resulting string: [fg64,64,192; works [33;22m does not

    opened by paulz 2
  • Testing: Add `LinuxMain.swift`.

    Testing: Add `LinuxMain.swift`.

    In all likelihood, Swift Package Manager will eventually no longer require this.

    However, PrettyColors will soon be supporting too many non-Darwin versions of Swift to test manually, as was done previously.

    Thankfully, Sourcery now provides tooling to generate LinuxMain.swift on macOS.

    Ideally, this would be automated, but probably not worth the effort in the near future; pull requests with test changes will need vigilance in requiring LinuxMain.swift changes, should be easy enough to remember… 😅

    opened by jdhealy 1
  • [RFC] Request for Comments

    [RFC] Request for Comments

    opened by jdhealy 0
  • Swift 4

    Swift 4

    Hello. Thank you for PrettyColors. In this pull request I fixed the warning messages that appear when compiling PrettyColors in Xcode 11.6 / Swift 4. And also added some news tasks for Travis CI. I think I also fixed #25 in this pull request.

    opened by RomanPodymov 1
  • The Xcode project can't be built with Xcode 10.2

    The Xcode project can't be built with Xcode 10.2

    That's because the project's SWIFT_VERSION build setting is still 3.0, but Xcode 10.2 (Swift 5 compiler) drops support for Swift 3 language mode, so the setting must be changed to 4.0 at least.

    opened by ikesyo 0
  • Migrate to Swift 4.2

    Migrate to Swift 4.2

    Currently, this library supports Swift 3.x.

    However, Xcode 10.2 drops supporting for Swift 3.x. So we can't build Carthage on Xcode 10.2 because of this library.

    This PR make it dropping Swift 3.x and Xcode 8.x/9.x supporting.

    opened by giginet 3
  • Manual Installation

    Manual Installation

    CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

    It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

    opened by lfarah 0
Releases(5.0.2)
Owner
J.D. Healy
J.D. Healy
Hue is the all-in-one coloring utility that you'll ever need.

Hue is the all-in-one coloring utility that you'll ever need. Usage Hex You can easily use hex colors with the init(hex:) convenience initializer on U

Christoffer Winterkvist 3.4k Jan 3, 2023
Hue is the all-in-one coloring utility that you'll ever need

Hue is the all-in-one coloring utility that you'll ever need. Usage Hex You can easily use hex colors with the init(hex:) convenience initializer on U

Christoffer Winterkvist 3.4k Jan 3, 2023
A pure Swift library that allows you to easily convert SwiftUI Colors to Hex String and vice versa.

iOS · macOS · watchOS · tvOS A pure Swift library that allows you to easily convert SwiftUI Colors to Hex String and vice versa. There is also support

Novem 3 Nov 20, 2022
UIGradient - A simple and powerful library for using gradient layer, image, color

UIGradient is now available on CocoaPods. Simply add the following to your project Podfile, and you'll be good to go.

Đinh Quang Hiếu 247 Dec 1, 2022
An unintrusive & light-weight iOS app-theming library with support for animated theme switching.

Gestalt Gestalt is an unintrusive and light-weight framework for application theming with support for animated theme switching. Usage Let's say you wa

Vincent Esche 327 Nov 8, 2022
Yet another extension to manipulate colors easily in Swift and SwiftUI

DynamicColor provides powerful methods to manipulate colors in an easy way in Swift and SwiftUI. Requirements • Usage • Installation • Contribution •

Yannick Loriot 2.8k Dec 30, 2022
Colour blindness simulation and testing for iOS

Color Deficiency Snapshot Tests This package makes it easier for you to understand the implications of your app's design on users with various types o

James Sherlock 69 Sep 29, 2022
A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.

Installation Drag the included Colours.h and Colours.m files into your project. They are located in the top-level directory. You can see a demo of how

Ben Gordon 3.1k Dec 28, 2022
A powerful and easy to use live mesh gradient renderer for iOS.

MeshKit A powerful and easy to use live mesh gradient renderer for iOS. This project wouldn't be possible without the awesome work from Moving Parts a

Ethan Lipnik 51 Jan 1, 2023
ChromaColorPicker - An intuitive HSB color picker built in Swift

An intuitive HSB color picker built in Swift. Supports multiple selection handles and is customizable to your needs.

Jonathan Cardasis 536 Dec 29, 2022
Gradients 🌔 A curated collection of 180 splendid gradients made in swift

Gradients ?? A curated collection of 180 splendid gradients made in swift 180 splendid Gradients inspired by itmeo/webgradients View all the gradients

Gradients 775 Jan 1, 2023
HEX color handling as an extension for UIColor. Written in Swift.

SwiftHEXColors HEX color handling as an extension for UIColor. Written in Swift.

Thi Doãn 692 Dec 22, 2022
Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more).

Swift 3 To use the Swift 3 version, add this to your Podfile (until 2.2 or higher is released): pod 'ChameleonFramework/Swift', :git => 'https://githu

Vicc Alexander 12.5k Dec 27, 2022
An attractive color generator for Swift. Ported from randomColor.js.

Random Color Swift Inspired by David Merfield's randomColor.js. It is a ported version to Swift. You can use the library to generate attractive random

Wei Wang 624 Jan 3, 2023
Flat UI color palette helpers written in Swift.

FlatUIColors (swift) install Make sure you have the latest version of CocoaPods (gem install cocoapods) that has Swift support. At the time of this wr

Bryn Bellomy 172 Dec 6, 2022
Conical (angular) gradient for iOS written in Swift

AEConicalGradient Conical (angular) gradient in Swift I hope that somebody will find this useful. And nice. Usage AEConicalGradient is a minion which

Marko Tadić 82 Dec 27, 2022
ImagePalette - Swift/iOS port of Android's Palette

ImagePalette - Swift/iOS port of Android's Palette

Shaun Harrison 54 Sep 23, 2022
Google Material Color Palette in Swift

Google Material Color in Swift Defined Google Material Color value ready to use in Swift refer to Google Material Design in Style/Color section ###How

Todsaporn Banjerdkit 48 Oct 30, 2019
A Lightweight But Powerful Color Kit (Swift)

BCColor A lightweight but powerful color kit (Swift) Features Pick Colors From Image Generate Monochrome Image Support Hex Color Style Lighten / Darke

Xiaobo Zhang 418 Nov 25, 2022