@@ -1952,6 +1952,15 @@ def to_uint8(self) -> Tuple[int, int, int, int]:
19521952 int (round (self .b * 255 )),
19531953 int (round (self .a * 255 )),
19541954 )
1955+
1956+ def to_hex (self ) -> str :
1957+ """Return color as a hex string, e.g. '#RRGGBBAA'."""
1958+ return "#{:02X}{:02X}{:02X}{:02X}" .format (* self .to_uint8 ())
1959+
1960+ def to_hex_argb (self ) -> str :
1961+ """Return color as a hex string in ARGB order, e.g. '#AARRGGBB'."""
1962+ r , g , b , a = self .to_uint8 ()
1963+ return "#{:02X}{:02X}{:02X}{:02X}" .format (a , r , g , b )
19551964
19561965 @staticmethod
19571966 def from_hsv (hsv_obj : Any ) -> "RgbaColor" :
@@ -2328,3 +2337,45 @@ def read_graphical_rendering_info(
23282337 # because it drives label text, not colour/size - handle separately if needed.
23292338
23302339 return result if found else None
2340+
2341+ # def numpy_dtype_to_resqml_22_type(dtype: np.dtype, is_external: bool = True) -> Optional[str]:
2342+ # import energyml.resqml.v2_2.resqmlv2
2343+ # # ======== resqml22
2344+ # # BooleanXmlArrayList
2345+ # # FloatingPointXmlArrayList
2346+ # # IntegerXmlArrayList
2347+ # # BooleanXmlArray
2348+ # # StringXmlArray
2349+ # # FloatingPointXmlArray
2350+ # # IntegerXmlArray
2351+ # # ======= common23
2352+ # # BooleanExternalArray
2353+ # # StringExternalArray
2354+ # # FloatingPointExternalArray
2355+ # # IntegerExternalArray
2356+ # # ======= common21
2357+ # # Point2DHdf5Array
2358+ # # Point2dHdf5Array
2359+ # # Point3DHdf5Array
2360+ # # Point3dHdf5Array
2361+ # # StringHdf5Array
2362+ # # BooleanHdf5Array
2363+ # # DoubleHdf5Array
2364+ # # IntegerHdf5Array
2365+
2366+ # suffix = "ExternalArray" if is_external else "XmlArray"
2367+ # if np.issubdtype(dtype, np.bool_):
2368+
2369+
2370+
2371+
2372+ # def numpy_to_resqml_array(np_array: np.ndarray, resqlm_version: str = "2.2") -> Any:
2373+ # """
2374+ # Convert a NumPy array to a RESQML array object (e.g. RealArray, IntegerArray).
2375+
2376+ # :param np_array: The input NumPy array to convert.
2377+ # :param resqlm_version: The target RESQML version (default "2.2").
2378+ # :return: A RESQML array object containing the data from the NumPy array.
2379+ # """
2380+ # dtype = np_array.dtype
2381+
0 commit comments