Skip to content

A simple and quick to use Android library which changes the colour of text; compatible all the way down to API 1.

License

Notifications You must be signed in to change notification settings

hassie-dash/text-colouriser

Repository files navigation

Text Colouriser

Build Status Codacy Badge Download

A simple and quick to use Android library which changes the colour of text; compatible all the way down to API 1.

Screenshots

Dependencies

To use the library, add the dependency to your app module's build.grade file:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    
    // Add this dependency.
    compile 'uk.co.hassie:text-colouriser:0.0.1'
}

Example usage 1

TextView textView = (TextView) findViewById(R.id.textView);

TextColouriser textColouriser = new TextColouriser.Builder(HomeActivity.this)
    .setColour("#000000")
    .setText("Sample text")
    .colourise();

textView.setText(textColouriser.getColourisedText());

Example usage 2

TextView textView = (TextView) findViewById(R.id.textView);

TextColouriser textColouriser = new TextColouriser.Builder(HomeActivity.this)
    .setColour("#FFFFFF")
    .setText(textView)
    .colourise();

textView.setText(textColouriser.getColourisedText());

Methods

  • TextColouriser
    • getColourisedText() - Returns a spannable with the colour applied to the text.
  • TextColouriser.Builder
    • setColour(param) - The colour to be applied to the text. Can either be a hex code as a string or a colour integer value.
    • setText(param) - The text to be colourised. Can be any from the following: Character sequence, resource string, string and text view.

License

Copyright ©2017 Hassie.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A simple and quick to use Android library which changes the colour of text; compatible all the way down to API 1.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages