Jump to content

My last (hopefuly) question about colors


Recommended Posts

Alright, I have a color in the same format as this 'HKEY_CURRENT_USER\Control Panel\Colors', 'Background', my value is "154 171 35", which is a dark yellow color. I want that to become the background color around my small centered background wall paper.

For example, in the picture I attached:

I want the green to be changed to "154 171 35" by running some sort of code... Anyone have any ideas?

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

No. That image is centered, and the theme colour is around the image. It should be somewhere in there. Why not edit the colour registry?

I've already done that... Then, I logged off, went to work, came back and it's the background color was the dark yellow. However, I want a line that automatically updates the color.

Here's what I'm trying to get to work: (It requires the AutoitLib made by PaulIA)

#include <A3LGDIPlus.au3>
#include <A3LScreenCap.au3>
#include <Misc.au3>
#include <Color.au3>


$pictureDir = @Systemdir & "\oobe\images\mslogo.jpg"
$color = _chooseColor(2, 0 , 2)

ConsoleWrite('!RGB color is: ' & $color & @CRLF)

_ChangeDesktopBackground($pictureDir, 2, $color) ;Color is a decimal value

Func _ChangeDesktopBackground($sFile, $iPosition=3, $color = 0)
    Local $sCLSID, $tBuffer, $hImage, $sTemp

    ; Convert JPG image to BMP image
    _GDI_Startup()
    $hImage = _GDI_LoadFromFile($sFile)
    $sCLSID = _GDI_GetEncoderCLSID("BMP")
    $sTemp  = _Str_ChangeFileExt($sFile, ".bmp")
    _GDI_SaveToFile($hImage, $sTemp, $sCLSID)
    _GDI_DisposeImage($hImage)
    _GDI_Shutdown()

    $string =  _ColorGetRed($color) & ' ' & _ColorGetGreen($color) & ' ' &  _ColorGetBlue($color)
    ConsoleWrite('!Modified color is: ' & $color & @CRLF)

    ; Set wallpaper position
    
    RegWrite('HKEY_CURRENT_USER\Control Panel\Colors', 'Background', 'REG_SZ', $string)
    
    Switch $iPosition
        case 1 ; Tiled
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 2 ; Centered
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 3 ; Stretched
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    EndSwitch

    ; Set wallpaper
    $tBuffer = DllStructCreate("char Text[" & StringLen($sTemp) + 1 & "]")
    DllStructSetData($tBuffer, "Text", $sTemp)
    _API_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
    
EndFunc
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...