People have been wanting to see how I got this to work
Put this under your class
[DllImport("DwmApi")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
const int DWWMA_CAPTION_COLOR = 35;
in whatever function (main?)
get the window handle or hwnd like this
IntPtr hWnd = new WindowInteropHelper(this).EnsureHandle();
then define the color
int[] colorstr = new int[]{0xFF00FF};
the 0x string thing is formatted like this
0xRRGGBB
replace the letters to their corresponding values
then make it happen
DwmSetWindowAttribute(hWnd, DWWMA_CAPTION_COLOR, colorstr, 4);
note: this only works in windows 11
here is the complete version if your lazy
class MainWindow : Window
{
[DllImport("DwmApi")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
const int DWWMA_CAPTION_COLOR = 35;
public MainWindow()
{
IntPtr hWnd = new WindowInteropHelper(this).EnsureHandle();
int[] colorstr = new int[]{0xFF00FF};
DwmSetWindowAttribute(hWnd, DWWMA_CAPTION_COLOR, colorstr, 4);
}
}
oh yes and import these
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
Edit: the color goes in the BGR format, so make sure it goes blue, green, red and not red, green blue