In this video I’ll show you how to change the background and text color of Labels with Kivy and Python.

Changing the background color and text color of a Kivy Label is a little more complicated than changing the color of other widgets. We need to set a Canvas and create a rectangle first.

We’ll also look at making text bold and italic, as well as giving it a shadow background!

Python Code:
GitHub Code:

from import App
from kivy.uix.widget import Widget
from import ObjectProperty
from kivy.lang import Builder

# Designate Our .kv design file 
class MyLayout(Widget):
class AwesomeApp(App):
	def build(self):
		return MyLayout()

if __name__ == '__main__':

Kivy Design Code: label_color.kv
GitHub Code: label_color.kv

	font_size: 32
	background_normal: ''
	background_color: (0,0,1,1)

	background_color: (150/255,150/255,150/255,1)	

		orientation: "vertical"
		size: root.width, root.height

			text: "Name"
			font_size: 45
			background_color: (182/255, 66/255, 245/255, 1)
					rgba: self.background_color
					size: self.size
					pos: self.pos
			# Text Properties
			color: (0,1,0,1)
			bold: True
			italic: True
			outline_color: (0,0,1)
			outline_width: 10

			multiline: False

			text: "Clear"
			background_color: (1,0,0,1)

John Elder

John is the CEO of where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

1 comment

Your email address will not be published. Required fields are marked *

John Elder