Skip to content

AlirezaIvaz/TablerIcons

Repository files navigation

TablerIcons for Android

JitPack Apache2 API 21 Kotlin 1.8.0 Tabler Icons 2.35.0 Issues

TablerIcons (Github) is a set of over 4600 free MIT-licensed high-quality SVG icons for you to use in your projects.

This library offers you the vector drawable version of these icons with some additional features that you can easily use in your Android projects.

Adding to your project

1. Adding the library repository

If you're using the old project structure, add JitPack in your root build.gradle or build.gradle.kts file like this:

build.gradle
allprojects {
    repositories {
        ...
        maven {
            url 'https://jitpack.io'
        }
    }
}
build.gradle.kts
allprojects {
    repositories {
        ...
        maven("https://jitpack.io")
    }
}

Otherwise if you're using new project structure, add JitPack in your settings.gradle or settings.gradle.kts like this:

settings.gradle
dependencyResolutionManagement {
    ...
    repositories {
        ...
        maven {
            url 'https://jitpack.io'
        }
    }
}
settings.gradle.kts
dependencyResolutionManagement {
    ...
    repositories {
        ...
        maven("https://jitpack.io")
    }
}

2. Adding the library dependency

Gradle Version Catalog

First add dependency in your project version catalog like this:

libs.versions.toml
[version]
tablericons = "1.12.0" # You can find the latest version from releases page

[libraries]
tablericons = { group = "ir.alirezaivaz", name = "tablericons", version.ref = "tablericons" }

Then add the library dependency in your application module build.gradle or build.gradle.kts file like this:

build.gradle
dependencies {
    ...
    implementation libs.tablericons
}
build.gradle.kts
dependencies {
    ...
    implementation(libs.tablericons)
}

Legacy

Just add the library dependency in your application module build.gradle or build.gradle.kts file like this:

build.gradle
dependencies {
    ...
    def tablerIconsVersion = "1.12.0" // You can find the latest version from releases page
    implementation "ir.alirezaivaz:tablericons:$tablerIconsVersion"
}
build.gradle.kts
dependencies {
    ...
    val tablerIconsVersion = "1.12.0" // You can find the latest version from releases page
    implementation("ir.alirezaivaz:tablericons:$tablerIconsVersion")
}

Usage

You can see the list of icons categorized on this page.

Note: The names of all icons in this library start with ic_ and instead of - (dash) you should use _ (underline).
E.g: If you want to use an icon named arrow-back, you should change its name to ic_arrow_back.

XML views

Just call the desired icon from the drawables like this:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_arrow_back" />

Java/Kotlin codes

You've three ways to get and use the icons you want:

Java
import ir.alirezaivaz.tablericons.TablerIcons;

public class ActivityMain extends AppCompatActivity {

    @Override
    void onCreate(Bundle bundle) {
        super.onCreate(bundle);

        // Get icon directly from library `R` class
        int arrowBackIcon = ir.alirezaivaz.tablericons.R.ic_arrow_back;
        imageView.setImageResource(arrowBackIcon);

        // Use `TablerIcons` object
        imageView.setImageResource(TablerIcons.ArrowBackUp);

    }

}
Kotlin
import ir.alirezaivaz.tablericons.TablerIcons

class ActivityMain : AppCompatActivity() {
    override fun onCreate(bundle: Bundle?) {
        super.onCreate(bundle)

        // Get icon directly from library `R` class
        val arrowBackIcon = ir.alirezaivaz.tablericons.R.ic_arrow_back
        imageView.setImageResource(arrowBackIcon)

        // Use `TablerIcons` object
        imageView.setImageResource(TablerIcons.ArrowBackUp)

    }
}

Change the color of icons

If you want to change the color of all icons at once, override tabler_icon to your colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    ...
    <color name="tabler_icon">#2196F3</color>
</resources>

Otherwise, if you want to change the color of one icon, you can use app:tint attribute in your ImageView like this:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_arrow_back"
    app:tint="#2196F3" />

Licenses

Copyright 2017-2023 Alireza Ivaz

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.
TablerIcons
MIT License

Copyright (c) 2020-2023 Paweł Kuna

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.