# Panel:InsertColorChange

- **Ortam:** İstemci, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/Panel:InsertColorChange
- **Çeviri tarihi:** 2025-09-08

```lua
Panel:InsertColorChange( number r, number g, number b, number a )
```

## Açıklama

Bir [RichText](https://gmod.tr/wiki/RichText) elemanına renk değişikliği ekler. Bu değişiklik, başka bir renk değişikliği uygulanana kadar [Panel:AppendText](https://gmod.tr/wiki/Panel:AppendText) ile eklenen tüm metinlerin rengini etkiler.

## Argümanlar

1. [number](https://gmod.tr/wiki/number) **r**: Kırmızı değeri `(0 - 255)`.
2. [number](https://gmod.tr/wiki/number) **g**: Yeşil değeri `(0 - 255)`.
3. [number](https://gmod.tr/wiki/number) **b**: Mavi değeri `(0 - 255)`.
4. [number](https://gmod.tr/wiki/number) **a**: Alfa (şeffaflık) değeri `(0 - 255)`.

### Örnek

Metnin belirli bölümlerinde renk kodlaması olan bir RichText paneli oluşturur.

```lua
-- Bir pencere çerçevesi oluştur
TextFrame = vgui.Create( "DFrame" )
TextFrame:SetSize( 200, 200 )
TextFrame:Center()
TextFrame:SetTitle( "Colored text" )
TextFrame:MakePopup()

-- RichText paneli
local richtext = vgui.Create( "RichText", TextFrame )
richtext:Dock( FILL )
richtext:SetVerticalScrollbarEnabled( false )

-- Metin blokları
richtext:InsertColorChange( 255, 255, 192, 255 )
richtext:AppendText( "This is an example of " )

richtext:InsertColorChange( 0, 255, 0, 255 )
richtext:AppendText( "color coding " )

richtext:InsertColorChange( 255, 255, 192, 255 )
richtext:AppendText( "different segments of text throughout a " )

richtext:InsertColorChange( 255, 200, 0, 255 )
richtext:AppendText( "Rich Text panel.\n\n" )

richtext:InsertColorChange(64, 0, 255, 255 )
richtext:AppendText( "Here is another line of text shown in the color ")

richtext:InsertColorChange( 128, 0, 255, 255 )
richtext:AppendText( "purple." )

-- Panel yerleşime hazır olduğunda, yazı tipini ve arka plan rengini uygula
function richtext:PerformLayout()
	self:SetFontInternal( "Trebuchet18" )
	self:SetBGColor( Color( 0, 16, 32 ) )
end
```

**Çıktı:** ![](https://gmod.tr/api/uploads/wiki/d236d4e7cefb3a8ec14d.png)

### Örnek

[string.Explode](https://gmod.tr/wiki/string.Explode) ve rastgele renkler kullanarak kelime kelime renklendirme.

```lua
-- Bir pencere çerçevesi oluştur
local TextFrame = vgui.Create( "DFrame" )
TextFrame:SetSize( 300, 200 )
TextFrame:Center()
TextFrame:SetTitle( "Randomly Colored Words" )
TextFrame:MakePopup()

-- RichText paneli
local richtext = vgui.Create( "RichText", TextFrame )
richtext:Dock( FILL )
richtext:SetVerticalScrollbarEnabled( false )

local txt = {
	"Here's a fun example involving word by word text coloring.",
	"Each word is separated by a space, colored, and appended to the Rich Text panel individually.",
	"The colors are randomly generated shades of red, orange, yellow, and pink."
}

local txt_tbl = string.Explode( " ", txt, false )

for _, word in ipairs( txt_tbl ) do
	richtext:InsertColorChange( 255, math.random( 0, 255 ), math.random( 0, 255 ), 255 )
	richtext:AppendText( word .. " " )
end

function richtext:PerformLayout()
	self:SetFontInternal( "GModNotify" )
	self:SetBGColor( Color( 32, 16, 0 ) )
end
```

**Çıktı:** ![](https://gmod.tr/api/uploads/wiki/2e45285cc295da957006.png)

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/Panel:InsertColorChange
